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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.