Max lookup

I am trying to create a format rule to format specific serial numbers based off another spread sheet last entry on that serial number.  Here is what I have and I think its super close just not quite there.

LOOKUP( MAX( SELECT(Machine Cleanings[_ROWNUMBER], ([_THISROW].[Serial #] = [TDS Reading]) ) ), "Machine Cleanings", "_ROWNUMBER", "TDS Reading" ) >35

Which gives me this.

Note: This expression could impact performance.
(One randomly chosen value from this list
( ........The list of values of column 'TDS Reading' ........from rows of table 'Machine Cleanings' ........where this condition is true:
((The value of column '_RowNumber') is equal to (MAX( ................The list of values of column '_RowNumber' ................from rows of table 'Machine Cleanings' ................where this condition is true:
((The value of 'Serial #' from the row referenced by 'Serial #') is equal to (The value of column 'TDS Reading'))))))) is greater than (35)
Solved Solved
0 6 521
1 ACCEPTED SOLUTION

  1. Make a slice lastCleanings on your Machine Cleanings table with the following row filter condition:
      
      [key] = MAXROW("Machine Cleanings", "Date", 
                [Serial #] = [_ThisRow].[Serial #]
              )
      
  2. Add a new virtual column in the Machine Cleaning table, type Ref pointing towards the Serial List table, with the following app formula. This is to avoid a table lookup expression in your format rules that might cause your app to become sluggish. Make sure you include this column in your slice. 
      
      IF( IN([key], lastCleanings[key]), [Serial #], "")  
     
  3. Look for the newly-generated reverse reference column in your Serial List table and put it in below expression for format rule in your Serial List table.
      
      ANY([Related Machine Cleanings by newVC][TDS Reading]) > 35
     

View solution in original post

6 REPLIES 6

  1. Make a slice on the Machine Cleanings table will contain only the last entry per every serial number.
  2. Your format rule expression should compare the serial's row relevant column in the slice with your threshold. 

So maxrow on the slice expression?

I thought about ANY(
SELECT(
Machine Cleanings[TDS Reading],
(
[_ROWNUMBER]
= MAX(
SELECT(
Machine Cleanings[_ROWNUMBER],
([Serial #] = [_THISROW].[Serial #])
)))) 

 

But that gives me 

The expression is valid but its result type 'Number' is not one of the expected types: Yes/No

I'm not able to discern the structure of your table from your expressions, so please show the columns of your tables from the app editor. Thanks.

Screenshot 2023-08-06 4.27.27 PM.pngScreenshot 2023-08-06 4.26.54 PM.pngThese are the two tables.

  1. Make a slice lastCleanings on your Machine Cleanings table with the following row filter condition:
      
      [key] = MAXROW("Machine Cleanings", "Date", 
                [Serial #] = [_ThisRow].[Serial #]
              )
      
  2. Add a new virtual column in the Machine Cleaning table, type Ref pointing towards the Serial List table, with the following app formula. This is to avoid a table lookup expression in your format rules that might cause your app to become sluggish. Make sure you include this column in your slice. 
      
      IF( IN([key], lastCleanings[key]), [Serial #], "")  
     
  3. Look for the newly-generated reverse reference column in your Serial List table and put it in below expression for format rule in your Serial List table.
      
      ANY([Related Machine Cleanings by newVC][TDS Reading]) > 35
     

Works like a champ. Thanks.

Top Labels in this Space