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.
Hi everyone !
I have a bar chart like this :
I'd like to have all the pink together, then all the blue, etc on the same bar chart, while keeping the current order within a given color group.
If you need more context, these are average GPAs of different schools, color coded by states. And here is my model :
Thank you !
Solved! Go to Solution.
You can sort a chart using a measure that is not on the chart by adding the measure to the tooltip.
Then setting the sort on the chart to use the measure:
Now the sort measure. First it calcualtes an alphabetical ranking of the states and multiplies that by 100 then adds the ranking of the school based on [Average GPA]. The * 100 + school ranking returns something like:
All Arizona schools are ranked 1__ then the shool ranking is added on so we get 101, 102, 103 for Arizona schools, 201, 202, 203 for California schools, etc.
Sort Measure =
DIVIDE ( [AVG GPA], [AVG GPA] ) *
(
RANKX(ALL(FactTable),CALCULATE(MAX(FactTable[State])),,ASC,Dense) * 100 +
RANKX(ALL(School),[AVG GPA],,DESC,Dense)
)
The
DIVIDE ( [AVG GPA], [AVG GPA] ) *
Keeps the ranking from calculating where there is no GPA.
I have attached my sample file for you to look at.
You can sort a chart using a measure that is not on the chart by adding the measure to the tooltip.
Then setting the sort on the chart to use the measure:
Now the sort measure. First it calcualtes an alphabetical ranking of the states and multiplies that by 100 then adds the ranking of the school based on [Average GPA]. The * 100 + school ranking returns something like:
All Arizona schools are ranked 1__ then the shool ranking is added on so we get 101, 102, 103 for Arizona schools, 201, 202, 203 for California schools, etc.
Sort Measure =
DIVIDE ( [AVG GPA], [AVG GPA] ) *
(
RANKX(ALL(FactTable),CALCULATE(MAX(FactTable[State])),,ASC,Dense) * 100 +
RANKX(ALL(School),[AVG GPA],,DESC,Dense)
)
The
DIVIDE ( [AVG GPA], [AVG GPA] ) *
Keeps the ranking from calculating where there is no GPA.
I have attached my sample file for you to look at.
That's absolutely perfect, thank you so much !
My Average GPA was actually not a measure but a field in the FactTable (forgot to show it in my simplified model) but using
MAX(FactTable[Average GPA])
instead of just [Average GPA] solved that issue 🙂
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
95 | |
77 | |
65 | |
53 |
User | Count |
---|---|
144 | |
105 | |
102 | |
89 | |
63 |