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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
BowPen
Frequent Visitor

ALLSELECTED

Im using RANKX(ALLSELECTED because I want to rank base on what is shown on my visual. Sample, I filter on a visual to only get the top 15 and I want those ranked from 1 to 12. Using ALLSELECTED work but it takes a long time to load the result since its checking each row of the entire table. Is there an alternative for this? I can only imagine the impact when we reach a 500k rows or more.

3 REPLIES 3
lbendlin
Super User
Super User

What kind of visual is it?  Use Performance Analyzer to check the DAX query that feeds your visual. You can use that as the basis for your ranking measure.

// DAX Query
DEFINE
VAR __DS0FilterTable =
FILTER(
KEEPFILTERS(VALUES('plantedtrial'[plant_quantity])),
'plantedtrial'[plant_quantity] > 0
)

VAR __SQDS0Core =
SUMMARIZECOLUMNS(
'variety'[variety_name],
__DS0FilterTable,
"yieldplantquantity", 'yield_measures'[yieldplantquantity]
)

VAR __SQDS0BodyLimited =
TOPN(15, __SQDS0Core, [yieldplantquantity], 0)

VAR __DS0Core =
SUMMARIZECOLUMNS(
'variety'[variety_name],
__DS0FilterTable,
__SQDS0BodyLimited,
"sortr3", 'rankround_measures'[sortr3],
"eliminatedrank", 'rankround_measures'[eliminatedrank],
"rankround1", 'rankround_measures'[rankround1],
"rankround2", 'rankround_measures'[rankround2],
"rankround3", 'rankround_measures'[rankround3]
)

VAR __DS0PrimaryWindowed =
TOPN(1001, __DS0Core, [sortr3], 0, 'variety'[variety_name], 1)

EVALUATE
__DS0PrimaryWindowed

ORDER BY
[sortr3] DESC, 'variety'[variety_name]

here's the performance review and the visual is just the stacked bar chart

now take this query into DAX Studio and run it there after enabling Query Plan.  Check for excessive number of records.  See if you can isolate the performance of your individual rankround measures.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.