Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hello. A complete novice here I'm afraid. I work in a school and we are just exploring what power bi can do to help us with data analysis. I am trying to custom sort my tables to accomdate our grading bands (beginning, working towards, expected, etc.) as it only wants to sort alphabetically at the moment. Can anyone point me in the right direction of how I can set this up please? also if there is a way to assign colours to them all more permanently (for charts and graphs) that would be great i.e beginning - red, working towards - orange. I know how to manually change the colours but wondered if there is a way to automate this. Thanks in advance for any hints and tips!
Solved! Go to Solution.
Create a column in Power Query named grading bands sort and mark it as the sort column from Column Tools in the visual UI.
If you create it in DAX, you need an additional column to avoid circular dependencies.
grading bands 1 = [grading bands]
Then sort grading bands 1 on grading bands sort and use that in vsiaul
Power query new column
if [GradingBand] = "Beginning" then 1
else if [GradingBand] = "Working Towards" then 2
else if [GradingBand] = "Expected" then 3
else 999 // catch-all for anything else
DAX
grading bands sort=
SWITCH(
[GradingBand],
"Beginning", 1,
"Working Towards", 2,
"Expected", 3,
999 // default
)
For conditional formatting you can have measure like
GradingBandColor =
SWITCH(
SELECTEDVALUE( 'GradesTable'[GradingBand] ),
"Beginning", "#FF0000", // Red
"Working Towards", "#FFA500", // Orange
"Expected", "#00B050", // Green, for example
"#808080" // Default gray if not matched
)
And use in conditional formatting using Field value option
How to Create Sort Column and Solve Related Errors:
https://www.youtube.com/watch?v=KK1zu4MBb-c
How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pan...
Create a column in Power Query named grading bands sort and mark it as the sort column from Column Tools in the visual UI.
If you create it in DAX, you need an additional column to avoid circular dependencies.
grading bands 1 = [grading bands]
Then sort grading bands 1 on grading bands sort and use that in vsiaul
Power query new column
if [GradingBand] = "Beginning" then 1
else if [GradingBand] = "Working Towards" then 2
else if [GradingBand] = "Expected" then 3
else 999 // catch-all for anything else
DAX
grading bands sort=
SWITCH(
[GradingBand],
"Beginning", 1,
"Working Towards", 2,
"Expected", 3,
999 // default
)
For conditional formatting you can have measure like
GradingBandColor =
SWITCH(
SELECTEDVALUE( 'GradesTable'[GradingBand] ),
"Beginning", "#FF0000", // Red
"Working Towards", "#FFA500", // Orange
"Expected", "#00B050", // Green, for example
"#808080" // Default gray if not matched
)
And use in conditional formatting using Field value option
How to Create Sort Column and Solve Related Errors:
https://www.youtube.com/watch?v=KK1zu4MBb-c
How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pan...
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 57 | |
| 38 | |
| 35 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 73 | |
| 70 | |
| 37 | |
| 35 | |
| 25 |