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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Rank by Region

Hello Experts

I need your help .

I am trying to Rank(on below data ) by Region but not able to get the right solution.

Here is my sample data. I need to sum emp count and Tenure by facility  and  get ave (Tenure /emp count ) and based on ave value rank  by Region . TIA

REGIONFACILITYEmp Count          Tenure
USAabc8101.06
USAabc8101.73
USAabc8102.37
USAabc8103.06
USAabc8103.7
USAxyz635.64
USAxyz535.85
USAxyz748.89
USAxyz850.92
USAxyz951.59
CANADAForest516.27
CANADAForest417.2
CANADAForest417.54
CANADAForest619.99
CANADAForest620.51
CANADALeed723.35
CANADAWoods723.94
CANADAWoods724.51
CANADAWoods825.17
CANADAWoods825.81
2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Create two measures like

 


Avg = Divide(sum(Table[Tenure]), sumx(summarize(Table, Table[FACILITY], Table[Emp Count]),[Emp Count]))

 

Rankx(allselected(Table[Region]), [Avg],,desc, dense)

 

For Rank Refer these links, if needed


https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale

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

View solution in original post

smpa01
Super User
Super User

@Anonymous  you need two measures for this

 

_avg = 
DIVIDE (
    CALCULATE (
        SUM ( 'Table 1'[Emp Count] ),
        ALLEXCEPT ( 'Table 1', 'Table 1'[FACILITY] )
    ),
    CALCULATE (
        SUM ( 'Table 1'[Tenure] ),
        ALLEXCEPT ( 'Table 1', 'Table 1'[FACILITY] )
    )
)

_rank = 
RANKX (
    FILTER (
        ALLSELECTED ( 'Table 1' ),
        'Table 1'[REGION] = MAX ( 'Table 1'[REGION] )
    ),
    [_avg],
    ,
    ASC,
    DENSE
)

 

 

smpa01_0-1640873130391.png

 

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,


Could you tell me if your problem has been solved?

I think @smpa01 's solution is good.
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your problem.


Best Regards,
Stephen Tao

smpa01
Super User
Super User

@Anonymous  you need two measures for this

 

_avg = 
DIVIDE (
    CALCULATE (
        SUM ( 'Table 1'[Emp Count] ),
        ALLEXCEPT ( 'Table 1', 'Table 1'[FACILITY] )
    ),
    CALCULATE (
        SUM ( 'Table 1'[Tenure] ),
        ALLEXCEPT ( 'Table 1', 'Table 1'[FACILITY] )
    )
)

_rank = 
RANKX (
    FILTER (
        ALLSELECTED ( 'Table 1' ),
        'Table 1'[REGION] = MAX ( 'Table 1'[REGION] )
    ),
    [_avg],
    ,
    ASC,
    DENSE
)

 

 

smpa01_0-1640873130391.png

 

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
amitchandak
Super User
Super User

@Anonymous , Create two measures like

 


Avg = Divide(sum(Table[Tenure]), sumx(summarize(Table, Table[FACILITY], Table[Emp Count]),[Emp Count]))

 

Rankx(allselected(Table[Region]), [Avg],,desc, dense)

 

For Rank Refer these links, if needed


https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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