Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi all,
I feel this one should be a simple fix but its just not coming to me....
Ive tried LEFT / SWITCH functions but Ive yet to come up with the correct dax function.... I've seen this can be done very quickly within PowerQuery however the table I need to create the new column in was added as a UNION of different columns and my new table isn't showing within PowerQuery.
I would like to show the text column below within a new column as only numbers..... Please note Not Applicable will be equal to 0.
| Score Text | Score Number |
| 10 Totally Satisfied | 10 |
| 5 Neutral | 5 |
| 1 Totally Dissatisfied | 1 |
| Not Applicable | 0 |
Any help, as always, would be appreciated 🙂
THANK YOU!!
Solved! Go to Solution.
@eilidh3 does this work for you?
Column =
VAR _1 =
ADDCOLUMNS ( 'Table', "new", SUBSTITUTE ( 'Table'[Score Text], " ", "|" ) )
VAR _2 =
ADDCOLUMNS (
GENERATE (
_1,
ADDCOLUMNS (
GENERATESERIES ( 1, PATHLENGTH ( [new] ) ),
"_txt", TRIM ( PATHITEM ( [new], [Value], TEXT ) )
)
),
"num", IFERROR ( CONVERT ( [_txt], INTEGER ), 0 )
)
RETURN
CALCULATE (
MAXX (
ADDCOLUMNS (
'Table',
"scoreNum", MAXX ( FILTER ( _2, EARLIER ( 'Table'[Score Text] ) = [Score Text] ), [num] )
),
[scoreNum]
)
)
@eilidh3 does this work for you?
Column =
VAR _1 =
ADDCOLUMNS ( 'Table', "new", SUBSTITUTE ( 'Table'[Score Text], " ", "|" ) )
VAR _2 =
ADDCOLUMNS (
GENERATE (
_1,
ADDCOLUMNS (
GENERATESERIES ( 1, PATHLENGTH ( [new] ) ),
"_txt", TRIM ( PATHITEM ( [new], [Value], TEXT ) )
)
),
"num", IFERROR ( CONVERT ( [_txt], INTEGER ), 0 )
)
RETURN
CALCULATE (
MAXX (
ADDCOLUMNS (
'Table',
"scoreNum", MAXX ( FILTER ( _2, EARLIER ( 'Table'[Score Text] ) = [Score Text] ), [num] )
),
[scoreNum]
)
)
This works a charm! I would like to know how to do it the other way around, but can't seem to figure it out.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 5 | |
| 5 |
| User | Count |
|---|---|
| 24 | |
| 11 | |
| 11 | |
| 9 | |
| 8 |