Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have these "Years as EL" in those groups. Is there a way to display those in the correct order? (5-9 should be after 0-4, for example). I have this issue with a few tables where the sorting needs to be rearranged. I know you need to create a reference/dimension table with the specificed sort order and use a "RELATED" function, but I can't figure out how to create a dimension/reference table either. Please help!
Solved! Go to Solution.
Hi @taylororiger ,
[Year as EL] is a text type column, so Power BI will sort it by sort each word which is in same poisition. Power BI doesn't support us to sort a column by another calculated column which is built based on this one. So if you create a calcualted column like PijushRoy mention and sort [Year as EL] by this column, you will get an error as below.
Here I suggest you to create a conditional column in Power Query Editor and select change column type to whole number.
Then you can sort [Year as EL] by this custom column.
For reference: Sort one column by another column in Power BI Desktop
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @taylororiger ,
[Year as EL] is a text type column, so Power BI will sort it by sort each word which is in same poisition. Power BI doesn't support us to sort a column by another calculated column which is built based on this one. So if you create a calcualted column like PijushRoy mention and sort [Year as EL] by this column, you will get an error as below.
Here I suggest you to create a conditional column in Power Query Editor and select change column type to whole number.
Then you can sort [Year as EL] by this custom column.
For reference: Sort one column by another column in Power BI Desktop
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Create a Calculated Column with below DAX
Sort Col= VAR _yearsasel = SELECTEDVALUE(Table'Years as EL')
SWITCH(
TRUE(),
_yearsasel = "0-4",1,
_yearsasel = "5-9",2,
_yearsasel = "10-14",2,
so on
Click the column YEARS AS EL and select SORT BY from ribbon and select new calculated column.
In the visual, 3 dot, Sort by YEARS AS EL and acceding order
If you have any question, please posted
If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos
Other option you can follow - https://community.powerbi.com/t5/Desktop/quot-Sort-by-column-quot-from-a-related-table/m-p/89265#M37...
Proud to be a Super User! | |
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 35 | |
| 34 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 137 | |
| 102 | |
| 71 | |
| 67 | |
| 65 |