Forum Discussion
Add text after numbers
Hi.
I want to add a column which adds the text "GB" after a column which has numbers in it.
Basically I want to take 'the colum to the right (TotalPhysicalMemory_GB) and add "GB" to it.
I tried Number.ToText but failed as the newly created column kept giving me "error" ..
btw, the right column is taking its data from the left column, where I cleaned it up a bit.
Appreciate all the help I can get to solve this matter.
Hi aso1 ,
You could try below M code to see whether it work or not.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjTVMzJVitUBssz0jM3ALCMjPQMDiJipsZ4ZlGVmqWdsDFFqZKhnZGgCZMcCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type number}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Number.ToText([Column1]) & " GB"), #"Sorted Rows" = Table.Sort(#"Added Custom",{{"Column1", Order.Ascending}}), #"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 0, 1) in #"Added Index"By the way, when you add "GB" after numbert, the column type will change to text, so it will sort by alphabetically. You need to create an index or rank column, then set it sort by index or rank column, it should work.
Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
11 Replies
- amitchandakSuper User
aso1 , refer if this can help
https://www.youtube.com/watch?v=R8qpB4Pp4UQ
https://zebrabi.com/power-bi-dax-webinar/
You can also have like
Measure= Sum(Table[Number]) & "Abc"
- aso1Helper II
thanks for the quick reply! really appreciate it.
im really sorry for being such a noob - trying my best to learn.
I get some syntax errors for the suggestions... i am sure im writing things incorrectly.
please help.
the suffixes almost did it - however, it gave me a bunch of numbers after the comma. I just need two placements. fx "15,25 GB"
- Angdmeye123New Member
I am trying to do something similar. I need my data to say "°F" behind it.
Table name: Table