How to use rank with parameter & calculated field

Hi,

I have a parameter to switch between two field - sample size & z-score. I want the functionality to switch the parameter and the crosstab view should rank according to selection.

sample size is calculated field - distinct_count({id})

z-score is a calculated field consisting of avgOver & stdevOver…

both calc field works fine individually and provides the correct output, so nothing on that end.

But when trying to use rank(z-score) or rank(sample_size) I get error

Expression rank({Z-Score}) for function rank has incorrect argument type rank(Decimal). Function syntax expects Non-empty List, List, Calculation Level
Non-empty List, List
‘rank()’.

Expression rank({sample_size}) for function rank has incorrect argument type rank(Number). Function syntax expects Non-empty List, List, Calculation Level
Non-empty List, List
‘rank()’.

You need to rank the z-score or sample size by a list.

It should look like this.

rank([{Z-Score} DESC])

rank([{sample_size} DESC])