Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
aso1
Helper II
Helper II

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. 

 

https://www.dropbox.com/s/xlxcm2feywkq4to/column.jpg?dl=0

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

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.

763.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

11 REPLIES 11
Angdmeye123
New Member

I am trying to do something similar. I need my data to say "°F" behind it.

 

Table name: Table 

amitchandak
Super User
Super 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"

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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. 

measure.jpg

 

dax.jpg

 

Annotation 2020-06-16 113753.jpg

 

 

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"

suffix.jpg

 

Hi @aso1 ,

 

Can you try this please:

NewColumn = CONCATENATE(Table1[TotalPhysicalMemory_GB], "GB")

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

hi Pragati!.. 

thanks. am I doing it right?... I get this error : 

newcolumn1.jpg

 

HI @aso1 ,

 

Please chnage Table1 to your table-name. It is an example.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

1_concat.jpg

this worked. 

 

1_concat2.jpg

 last thing : I would like only two digits after the dot. for example "23.99 GB"

How can I achieve this?.. 

 

Hi @aso1 ,

 

In order to limit number of decimals, you will need to modify your original colum "Total Physical Memory_GB" to have only 2 decimals.

This can be done under modelling tab.

perc.png

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

also, I cannot sort in order.. it does not work. why is that?

1_computer.jpg

dax
Community Support
Community Support

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.

763.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Pragati11
Super User
Super User

Hi @aso1 ,

 

You can use concatenate function in DAX to achieve this.

 

NewColumn = CONCATENATE(Table1[TotalPhysicalMemory_GB], "GB")

 

Replace Table1 in above DAX with your tablename.

 

Thanks,

Pragati

 

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors