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.
I want to trim the contents of an entire column in DAX.
It is a measure table, so I did not create this in PowerQuery M.
Does the ability exist within DAX to do this?
Example:
Original Table:
Header |
my text |
my text |
this text |
text my |
After Trim Table:
Header |
my text |
my text |
this text |
text my |
Solved! Go to Solution.
Hi @lpriceFTW ,
I guess Power BI automatically trims the values to eliminate additional spaces anywhere.
Just in case it doesn't, you can use TRIM function like below DAX:
1. For a trimmed new calculated column:
Trimmed Header = TRIM('Table'[Header])
2. For a trimmed new calculated measure:
Trimmed Header = TRIM(MAX('Table'[Header]))
Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!! Proud To Be a Super User !!! |
Hi @lpriceFTW
PBI auto Trim the white space in the column.I have taken your data.
when I take the data in visual / table then it auto display the values without white space.
Or if still is it there you can take TRIM() in measure like below.
It gives the same result.
I hope I answered your question!
Hi @lpriceFTW
PBI auto Trim the white space in the column.I have taken your data.
when I take the data in visual / table then it auto display the values without white space.
Or if still is it there you can take TRIM() in measure like below.
It gives the same result.
I hope I answered your question!
Hey thanks for the reply.
I ended up just creating a calculated column on the untrimmed measure table like you mentioned. I used the calculated trim column for my table relationships.
Hi @lpriceFTW ,
Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.
If these also don't help, please share more detailed information and description to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Hi @lpriceFTW ,
I guess Power BI automatically trims the values to eliminate additional spaces anywhere.
Just in case it doesn't, you can use TRIM function like below DAX:
1. For a trimmed new calculated column:
Trimmed Header = TRIM('Table'[Header])
2. For a trimmed new calculated measure:
Trimmed Header = TRIM(MAX('Table'[Header]))
Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!! Proud To Be a Super User !!! |
Hey thanks for the reply.
I ended up just creating a calculated column on the untrimmed measure table like you mentioned. I used the calculated trim column for my table relationships.
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 |
---|---|
105 | |
105 | |
87 | |
73 | |
66 |
User | Count |
---|---|
122 | |
112 | |
98 | |
79 | |
72 |