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
Anonymous
Not applicable

Help with Rank and filtering DAX

I am still new to dax and working on solution for ranking a dataset based on filters user has made and then show the higest rank record in each category .

in below case , I want to rank person_no and p_type based on priority_no  and  only show those records which have rank =1 based on filter selected (filters can be  worker_id ,org_id).

thanks in advance

a_idperson_nop_typepriority_noworker_idorg_id
1231M15ABC1
1431M16ABC1
1431N3ABC1
1641N4ABC1
1672M4ABC1
1 REPLY 1
themistoklis
Community Champion
Community Champion

@Anonymous 

 

Try the following formula to add the ranking:

Sorting Rank =
VAR current_person_no =
    MAX ( Sheet1[person_no] )
VAR current_type =
    MAX ( Sheet1[p_type] )
RETURN
    RANKX (
        FILTER (
            ALLSELECTED ( Sheet1 ),
            Sheet1[person_no] = current_person_no
                && Sheet1[p_type] = current_type
        ),
        CALCULATE ( SUM ( Sheet1[priority_no] ) ),
        ,
        DESC,
        DENSE
    )

 

Then on filter section filter when 'Sorting Rank' = 1

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.

Top Solution Authors