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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.