 # Pull a Virtual Column Calculation from One Table into Another Table

I have a Virtual Column with an app formula of that finds the MAX value of a column by the user. I want to pull this value into another table. How?

My current approach (which has not been working) was creating a reference column to the referenced table (with the Virtual Column Calc). Then I had a Column with the app formula [Reference Table Key].[Virtual Column Name] and the value comes back as nothing.

Thanks!

2 Likes

@Steve Thanks!
On a related note, is there an equivalent AppSheet expression to google’s LARGE((some list), 2) function that can find the second largest value in a list?

Not sure if it’s MAX( LIST(1, 2, 3) )

Cheers

Try:

``````INDEX(SORT(LIST(1, 2, 3), TRUE), 2)
``````

2 Likes

In case there are duplicate value in the list, this may help as well.

max({1,2,3}-list(max({1,2,3})))

1 Like

Thanks for the suggestions @tsuji_koichi
I’ve read the help doc on MAX(LIST(1, 2, 3)); however, I’m not understanding where the list string goes.

Here’s my formula which gives me the MAX value of my distance which totally works! However, how can I modify this to find the SECOND LARGEST distance using this MAX(LIST(1,2,3) formula?

MAX(
SELECT(ACTIVITY DATA[DISTANCE] , AND([EMAIL]=USEREMAIL(), [ACTIVITY]=“RIDE” ) )
)

Untested

max(SELECT(ACTIVITY DATA[DISTANCE] , AND([EMAIL]=USEREMAIL(), [ACTIVITY]=“RIDE” ) )-list(max(SELECT(ACTIVITY DATA[DISTANCE] , AND([EMAIL]=USEREMAIL(), [ACTIVITY]=“RIDE” ) ))))

1 Like

Try:

``````INDEX(
SORT(
SELECT(
ACTIVITY DATA[DISTANCE],
AND(
[EMAIL]=USEREMAIL(),
[ACTIVITY]=“RIDE”
),
TRUE
),
TRUE
),
2
)
``````
3 Likes

Thanks @Steve this worked! And thanks for linking the help docs. I’ll learn this index and sort function more. Cheers.

1 Like