Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I created a sample qvw (attached) in which I am trying to get the prescriber with maximum TRx. I am using FirstSortedValue function for satisfying the requirement.
However, I want this text to be independent of the prescriber selection. For instance, if P1, P2, P3 and P4 exist in the data and P4 is the prescriber with max TRx, how can I keep P4 as the top prescriber even when P1 and P2 are selected ?
Prescriber | TRx |
P1 | 200 |
P2 | 300 |
P3 | 400 |
P4 | 500 |
The top prescriber is obtained with expression
=FirstSortedValue(Prescriber, -Aggr(Sum(TRx), Prescriber))
Thanks,
Puneet.
Try
=FirstSortedValue({<Prescriber=>} Prescriber, -Aggr(Sum({<Prescriber=>}TRx), Prescriber))
Try
=FirstSortedValue({<Prescriber=>} Prescriber, -Aggr(Sum({<Prescriber=>}TRx), Prescriber))
Thank you ! I had tried putting Prescriber= inside sum within aggr, but wasn't aware that firstsortedvalue accepts set analysis as an argument too.