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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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.'

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.

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.

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.