Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
I'm having issues with the Text.PadEnd function. It seems like Power BI trims away the spaces I want to add.
The function I'm using is:
Text.PadEnd([firstname], 20, " ")
I can see the spaces while in Power Query Editor, but as soon as I close & apply they get removed. It works if I use dots or other characters, but it's the spaces I need.
It keeps the spaces when I add spaces in the beginning with:
Text.PadStart([firstname], 20, " ")
But that's not what I'm looking foor. I need the spaces after.
Is there any way around this? The column [firstname] is a text field.
I've also tried this code as suggested in another thread:
PadText = [firstname] & REPT ( " ", 15 - LEN ( [firstname] ) )
But I get an error saying "An argument of function 'REPT' has the wrong data type or has an invalid value.". It seems that the function only works with integers.
Sincerely
Ash
Solved! Go to Solution.
I reproduced your issue loading from the query editor, but this DAX column expression did work. Is [firstname] a column or a measure?
WithSpaces = PadEnd[Column1] & REPT(" ", 15 - LEN(PadEnd[Column1]))
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi @Anonymous ,
I created some data, used your function, and found it to work normally.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi,
I can't post any data because of the GDPR and such.
I didn't get it to work so I worked around it.
Thanks for the help!
Sincerely
Ash
Hi @Anonymous ,
I created some data, used your function, and found it to work normally.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
I reproduced your issue loading from the query editor, but this DAX column expression did work. Is [firstname] a column or a measure?
WithSpaces = PadEnd[Column1] & REPT(" ", 15 - LEN(PadEnd[Column1]))
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi,
[firstname] is a column with text as data type. Still getting this error.
Sincerely
Ash
User | Count |
---|---|
124 | |
106 | |
99 | |
63 | |
59 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |