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
SabineOussi
Skilled Sharer
Skilled Sharer

Raking within a group

Hello,

 

I am trying to represent sections averages in different schools from the highest section average to the lowest within each school.

Below is an example, each school is represented by a color and each section is represented by a bar.

Sections Averages.PNG

 

I tried that with a column chart and I can only sort by section (alphabetically) or by average (numerically).

 

I tried this ranking:
Rank = RANKX(VALUES([School Name]), RANK.EQ(1, [Final_average], ASC), ,ASC, Skip) 
but it didn't make any sense.

 

Any help on how can this be achieved in PBI?

 

Thanks.

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @SabineOussi,

 

You can use below formula to calculate the each rank of school, then use a clstered column chart to show the result.

 

Source table:

 

Capture2.PNG

 

Calculate column:

 

Ranking = RANKX(FILTER(Sheet2,Sheet2[School]=EARLIER(Sheet2[School])),[Average],[Average],DESC,Dense)

 

 

Visual:

 

Capture.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thank you @v-shex-msft

 

Unfortunately I am connected to a complex database and there are a lot of selections through slicers in order to come with this particular graph.

So your solution is giving me the overall rank of the sections and not on that particular selection, so it's not really by school.

 

What I did is convert the schools to a high value number and add that number to the raking column and have my chart sorted by that.

School_Ranking: School1 = 100000, School2 = 200000
Final_Ranking: School_Ranking + Ranking

And finally sections are ranked correctly according to their schools.

 

ranking.PNG

 

One thing remains is to re-rank these sections from 1 to n instead of that big number under each bar.

 

Any thoughts?

Hi @SabineOussi,

 

Perhaps you can try to calculate the new rank based on the filtered columns.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.