Skip to main content

Power BI

Needs Votes

Rankx in Direct Query Mode

Vote (37) Share
Hemanth's profile image

Hemanth on 04 Dec 2016 07:40:58

Rankx function needs to be supported in Direct Query Mode. If I am not using Analysis Services I should be able to still create a measure of Rank and also create things like Top 10 etc..

Comments (1)
Hemanth's profile image Profile Picture

Dylan Morgan on 05 Jul 2020 22:36:17

RE: Rankx in Direct Query Mode

'You can use countx over a filtered table to get this result. Essentially you want to iterate over a table. The basic implementation is as follows. You would want to decide how to handle ties and make adjustments, but for a simple implementation this will work.

=
VAR thisSales = EmployeeSales[Sales]
RETURN
COUNTX(
FILTER(
ALL('EmployeeSales'),
'EmployeeSales'[Sales] > thisSales
),
[Sales]
) + 1