Forum Discussion
JackWren
Helper II
4 years agoTop10 and bottom10 values within the same table - Improving performance
Hi everyone,
I trying to make it so that the end user can display the top 10 or bottom 10 customers within the same table, based on the measure Moving Difference2 .
It's giving me results but it's rather slow so, I was wondering has anyone ever tried something like that?
I'd rather avoid using bookmarks if I could but it might be best performance-wise.
My table that I used to know how to sort the data.
The measure :
TopOrBottom10 Customers =
Var SelectedTB = SELECTEDVALUE(AscOrDesc[Key])
Var Bottom =
If([Moving Difference2]=0,
blank(),
rankx(
filter(
all('Customer Portfolio'[CUSTOMER]),
[Moving Difference2]<>blank()),
[Moving Difference2],,
asc,
Dense
))
Var Top1 =
if([Moving Difference2]=0,
blank(),
rankx(
Filter(
all('Customer Portfolio'[CUSTOMER]),
[Moving Difference2]<>blank()),
[Moving Difference2],,
desc,
Dense
))
Var MovingDiffAsc = if(bottom<=10,[Moving Difference2])
Var MovingDiffDesc = if(Top1<=10,[Moving Difference2])
RETURN
Switch(
True(),
SelectedTB=0,MovingDiffAsc,
SelectedTB=1,MovingDiffDesc,
[Moving Difference2]
)
Thank you
Jack