How Perform Google Sheet equivalent Expressions/Functions

Hi @Steve
Maybe you could help answer this or point me to the right direction. I have a fictitious data set (table) in google sheets that is being populated by AppSheets shown below.

How would you get specific values that youโ€™re looking for based on this table? For example, if I wanted to find the MAX distance for the AppSheet USER (filtering out users) for ACTIVITY = โ€œRIDEโ€. Or another example, find out the highest elevation (also a MAX function) for the AppSheet USER (filtering out other users) for ACTIVITY = โ€œRIDEโ€, etc.

In google sheets, Iโ€™ll typically use a QUERY function of the dataset and select the columns and set the parameters of what Iโ€™m looking for but I want to explore to AppSheets making these calculations for me instead of taxing google sheets to make the calculations.

Anyways, interested to hear your thoughts.
Thanks!

0 8 223
8 REPLIES 8

Please try with an expression in a VC for distance

MAX(SELECT([DISTANCE], AND([ACTIVITY]=โ€œRIDEโ€, [TEAMMEMBERID]=[_THISROW].[TEAMMEMBERID]))
Please replace [ELEVATION] for maximum elevation and so on.

MAX() needs the list to be of numeric type. So columns [DISTANCE] and [ELEVATION] need to be numeric type( Number, decimal, date etc)

In general too many VCs with expressions that span over multiple rows ( SELECT() for example) could impact sync performance. So please be aware of that aspect.

HI Suvrutt,
Thanks for pointing me in the right direction with this, particularly with VCโ€™s being the the path to finding values in the data set.

When using your suggested expression, an error of
โ€œExpression โ€˜MAX(SELECT([DISTANCE], AND([ACTIVITY]=โ€œRIDEโ€, [TEAMMEMBERID]=[_THISROW].[TEAMMEMBERID]))โ€™ could not be parsed due to exception: Number of opened and closed parentheses does not match.โ€

Iโ€™ve read the MAX() and the SELECT() help docs which are great to try and fix the error myself. I think whatโ€™s throwing me off is the AND() nested within the SELECT() function so Iโ€™m unable to figure out whatโ€™s wrong with it but perhaps you do?

One thought I had the could be an alternative to [TEAMMEMBERID]=[_THISROW].[TEAMMEMBERID] is perhaps using the [EMAIL]=USEREMAIL() which is also included in the data set.

Anyways, these expressions are opening up a new chapter for me in this AppSheet journey.
Thanks!

Hi @Tony_Insua,

Sorry to have missed a closing parentthesis in the expression. Please try with

MAX(SELECT([DISTANCE], AND([ACTIVITY]=โ€œRIDEโ€, [TEAMMEMBERID]=[_THISROW].[TEAMMEMBERID])))

Well, the AND() combines the filtering conditions so that the SELECT() comes out with a list that filters only those records haveing [TEAMMEMBERID] belonging to the [TEAMMEMBERID] of the record being evaluated and where [ACTIVITY] is only โ€œRIDEโ€

HI @Suvrutt_Gurjar,
Thanks! I seem to have solved the issue with your help.
Iโ€™ve added the name of the table at the FRONT of [DISTANCE]. This has come back as TRUE.

MAX(SELECT(ACTIVITY DATA[DISTANCE], AND([ACTIVITY]=โ€œRIDEโ€, [TEAMMEMBERID]=[_THISROW].[TEAMMEMBERID])))

Interesting to see that once the table name is โ€œACTIVITY DATAโ€ is included, you donโ€™t have to include it again with [ACTIVITY] or [TEAMMEMBERID]

Yes, a table name was also required before distance

hi
try out function select ,this is like the filter function on google sheet
also look for lookup function in appsheet help, there is no exact query like function in appsheet.

Just to add, the end game to these expressions will be to get all of these values Iโ€™m looking for and reference them on another table where I can create a dashboard view of the key metrics. The journey continues.

Hi
Hope you can entertain this question .
Now that I have the result of the LONGEST DISTANCE, how can I pull this specific value into another table?

What Iโ€™m seeing is that the expression on one table is not translating back to the new table.

So what I had done was created a new (read only) table with a column called LONGEST DISTANCE and included another column called RECORDID.

RECORID is a reference to the ACTIVITY DATA table.

In the LONGEST DISTANCE column of this new table, the app formulation I used was [RECORDID].[LONGEST DISTANCE] so that it can peers into the activity data table in search for this column.

Iโ€™m getting a blank result.

When I check back to the LONGEST DISTANCE (Virtual Column) in the ACTIVITY DATA table the result is a number but itโ€™s just not translating back to the new table.

What are your thoughts on how to get this specifc value into another table?
Thanks in advance!

Top Labels in this Space