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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Smits474
Frequent Visitor

Rank with the actual values

Hey Guys,

 

I want to rank the name of persons. An example is given below.

I have different people with different types and different speeds on different dates and times.

I want to know which persons have the highest speed with the same type. 

I don't know how to use the rank function properly because if i use the max or min it returns 1 as value, but i want the actual speed of the person.

 

 Knipsel.JPG

7 REPLIES 7
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Smits474,

 

Please try below formulas:

Rank =
    RANKX (
        ALLEXCEPT ( TableRank, TableRank[Type] ),
        LASTNONBLANK ( TableRank[Speed], MAX ( TableRank[Date] ) ),
        ,
        DESC,
        DENSE
    )

MaxSpeed =
    CALCULATE ( MAX ( TableRank[Speed] ), ALLEXCEPT ( TableRank, TableRank[Type] ) )

If you still have any question, please feel free to ask.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 I want to have multiple tables outcome, with different tops.

 

I have made a new datasheet and i have made tables of what i want to be is the outcome.

 

The datasheet is:

:DatasheetDatasheet

In this situation, i sliced on the name 'Peter', type 'B' and date '15-02-2016'.

 

For 1: I want to know the top 5 of speed of all time with the same gender & type as Peter. 

11

For 2: I want to know the top 3 of speed with the angle of all time with the same gender & type as Peter. 

 

22

For 3: I want to know the top 2 of speed of the previous measure off Peter. 

33

 

I want all the outcomes in one page, so top N filtering isn't a solution.

I've tried the top N funtion but it gives me this error: 'The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.'

MattAllington
Community Champion
Community Champion

I'm not on my PC, but from memory. 

 

Add a slicer and select one of the types

Create a table and add the names

write a measure like this. 

 

Rank = rankx(all(tablename[name]),max(tablename[speed])). This should give the order (i.e. Rank). 

If you just want the speed, just use

=max(tablename[speed]) 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

When i use this rank, it only gives all the different persons rank 1

sorry, that was a silly mistake.  Try this

 

Rank = rankx(all(data[Name]),CALCULATE(max(data[Speed])))



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Same problem. And i only get the values of the person who is selected in my slicer, but i want all the other persons too. Maybe the top n function is better to use?

I tested this measure. If you put people on rows of a table, and a slicer on the type, it will give you the rank for each person. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.