Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JackWren
Helper II
Helper II

Top10 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. 

 

JackWren_0-1634212884767.png

 

My table that I used to know how to sort the data. 

JackWren_1-1634213105791.png

 

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
2 REPLIES 2
lbendlin
Super User
Super User

"based on the measure Moving Difference2" 

 

Please show the measure.

I used another way finally because my dataset is too big and the measure was probably too complex. 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.