Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi
I have a table with many rows of repairs our complany has completed, depending on the age of the job a age distribution is added. However the order of the age distribution is not correct. I need to add a new column with a multiple if statement to say if ="0-4" , then 1, IF ="5-9", then 2, IF = "10-14", then 3
and so on. I have shown the order I would like
| Order | WorkingDaysToCompBuckets |
| 1 | 0-4 |
| 2 | 5-9 |
| 3 | 10-14 |
| 4 | 15-19 |
| 5 | 20-24 |
| 6 | 25-29 |
| 7 | 30-34 |
| 8 | 35-39 |
| 9 | 40-44 |
| 10 | 45-49 |
| 11 | 50-54 |
| 12 | 55-59 |
| 13 | 60-64 |
| 14 | 65-69 |
| 15 | 70-74 |
| 16 | 75-79 |
| 17 | >=80 |
Thank you
Richard
Solved! Go to Solution.
Instead of multiple if statements try this approach.
See attached file as well
First extract the ending range value using
EndingRange =
VAR pos1 =
SEARCH ( "-", [WorkingDaysToCompBuckets], 1, 0 )
VAR pos2 =
IF ( pos1 = 0, SEARCH ( "=", [WorkingDaysToCompBuckets], 1, 0 ), pos1 )
RETURN
VALUE (
RIGHT ( [WorkingDaysToCompBuckets], LEN ( [WorkingDaysToCompBuckets] ) - pos2 )
)
Then we can RANK this column
RANK = RANKX(Table1,[EndingRange],,ASC,Dense)
Instead of multiple if statements try this approach.
See attached file as well
First extract the ending range value using
EndingRange =
VAR pos1 =
SEARCH ( "-", [WorkingDaysToCompBuckets], 1, 0 )
VAR pos2 =
IF ( pos1 = 0, SEARCH ( "=", [WorkingDaysToCompBuckets], 1, 0 ), pos1 )
RETURN
VALUE (
RIGHT ( [WorkingDaysToCompBuckets], LEN ( [WorkingDaysToCompBuckets] ) - pos2 )
)
Then we can RANK this column
RANK = RANKX(Table1,[EndingRange],,ASC,Dense)
Thank you this works fine
Richard
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 53 | |
| 45 | |
| 38 | |
| 16 | |
| 14 |
| User | Count |
|---|---|
| 86 | |
| 70 | |
| 39 | |
| 29 | |
| 28 |