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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Not applicable

Rank in direct query mode



How would I go about ranking values in direct query mode.  The DAX function RANK does not seem to work.


Any help appreciated





New Member

Looks like it is not supported . It should get added as a feature

View solution in original post

Helper II
Helper II

I faced this a couple of months ago


two ways to do this, you can create a Measure using rankx 


this means that when you slice your data, your rankings get recalculated


another option is to do the rank within the SQL select query


this means your ranking remains the same regardless of how you slice your data


this will show you how to do it the SQL way:



Thank you so much for your reply. I tried the RANKX way but I got an error saying the RankX function is not supported under direct query model. How did you solve it? By rankx or SQL ? 

go to file->options and settings -> options


under direct query, select "allow unrestricted measures"

That's a right way to do it. However, all DAX functions are only allowed to apply in measures. I want to add each serial number 's rank as a new column as by comparing their timestamp and then focus on test data from the same rank, like how many failures do I got on the first run. I don't really think I could handle that with one single measure.

Helper II
Helper II

Did you work it out?

New Member

Looks like it is not supported . It should get added as a feature

Helpful resources

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.

Top Solution Authors