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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
CamIAm88
Regular Visitor

Help with ranking Employees for each group using RANKX

I have a dashboard created where the user selects an employee and a table displays metrics for all the work groups worked by that employee. I would like to add a column to the table on my dashboard that displays how that KPI ranks amongst all other users for that group. Please note, I would like to create a measure since my model is large and I am running low on space.

 

Below are examples of my existing data and the DAX I'm currently using to calculate the tranking:

 

DAX:

 

 

 

RankEmployee = 
RANKX(
    FILTER(
        ALL(Table_1[Employee_A], (Table_1[Work_Group]),
        Table_1[Work_Group] = MAX(Table_1[Work_Group])
        ),
        CALCULATE( SUM( Table_1[KPI]) ) -- Note actual calculate simplified for example
 	)

 

 

 

Example of Existing Table (3 columns, Employee, Work_Group, KPI):

 

EmployeeWork_GroupKPI
AWork Type A100
AWork Type B10
AWork Type C50
BWork Type A90
BWork Type B45
BWork Type C1
CWork Type A80
CWork Type B60

 

Example of the desired outcome for the table in the dashboard (4 columns, Employee, Work_Group, KPI, Rank):

 

EmployeeWork_GroupKPIRank
AWork Type A1001
AWork Type B103
AWork Type C501
BWork Type A902
BWork Type B452
BWork Type C12
CWork Type A803
CWork Type B601

 

 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @CamIAm88 ,

 

Please try:

RankEmployee =
VAR _a =
    ADDCOLUMNS (
        ALL ( Table_1 ),
        "Rank",
            RANKX (
                FILTER ( ALL ( Table_1 ), [Work_Group] = EARLIER ( Table_1[Work_Group] ) ),
                [KPI]
            )
    )
RETURN
    MAXX (
        FILTER (
            _a,
            [Employee] = MAX ( 'Table_1'[Employee] )
                && [Work_Group] = MAX ( 'Table_1'[Work_Group] )
        ),
        [Rank]
    )

 

Final output:

vjianbolimsft_0-1668159686774.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @CamIAm88 ,

 

Please try:

RankEmployee =
VAR _a =
    ADDCOLUMNS (
        ALL ( Table_1 ),
        "Rank",
            RANKX (
                FILTER ( ALL ( Table_1 ), [Work_Group] = EARLIER ( Table_1[Work_Group] ) ),
                [KPI]
            )
    )
RETURN
    MAXX (
        FILTER (
            _a,
            [Employee] = MAX ( 'Table_1'[Employee] )
                && [Work_Group] = MAX ( 'Table_1'[Work_Group] )
        ),
        [Rank]
    )

 

Final output:

vjianbolimsft_0-1668159686774.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@CamIAm88 , The measure you provided should work with small change

 

RankEmployee =
RANKX(
FILTER(
ALL(Table_1[Employee_A], (Table_1[Work_Group]),
Table_1[Work_Group] = MAX(Table_1[Work_Group])
)),
CALCULATE( SUM( Table_1[KPI]) ) -- Note actual calculate simplified for example
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for your quick response Amit. There was a typo in my DAX after rewriting it for the post but where I'm having the issue is with the results. The DAX designates a rank 1 to all work groups.

 

I would like for the measure to compare the KPI for the selected employee to that of all employees per Work_Group. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors