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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Nielf
Helper I
Helper I

Concatenate three types columns - DAX or Power Query

A have a use case, where I need to concatenate three columns from the same table. I also need to format one of the columns in the process.

 

I am wondering whether the best option is to use DAX or Power Query. 

 

I have three columns like this:

 

Name (text)Win % (whole number)Sales price (fixed decimal number)
Blah blah 150514594105,00

 

Which I would like to end up like this, where the Sales price gets formatted as millions in the process. 

 

Blah blah 1 (50% / M514)

 

I have tried various approached but haven't really found a solution. 

 

I hope you can help. 

1 ACCEPTED SOLUTION
Idrissshatila
Super User
Super User

Hello @Nielf ,

 

try this

 

Newcolumn = Name & " " & "(" & win% & ")" & " " & Price

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

 

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Nielf
Helper I
Helper I

Thanks. Both of the solutions work as expected.

MAwwad
Solution Sage
Solution Sage

 

Power Query offers more capabilities to transform data in various way, like to change the format of the Sales Price column you can use the Power Query's Number.ToText() function.

Here's an example of how to use Power Query to format the Sales Price column to show values in millions:

 

Copy code
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("...", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Win% = _t, Sales Price = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Win%", Int64.Type}, {"Sales Price", type number}}), #"Formatted Sales Price" = Table.TransformColumns(#"Changed Type", {{"Sales Price", each Number.ToText(_, "0.0,,M")}}) in #"Formatted Sales Price"

 

 

The above code will format the Sales Price column as millions and it uses Table.TransformColumns() to change the column type to text using Number.ToText() function.

Then, you can use DAX to create a calculated column by concatenating the columns with the correct separators and formatting the values like the next example

 

Copy code
Concatenated Column = CONCATENATE([Name]," (",[Win%],"% / ", [Sales Price], ")")
 

If the use case is simple and you just need to concatenate the column and format one of them, the above code should be more than enough, but if you have more complex use cases, Power Query will be better suited to handle them.

Keep in mind that the above code is just an example, you'll need to adjust the code to match the column and table names of your dataset.

Idrissshatila
Super User
Super User

Hello @Nielf ,

 

try this

 

Newcolumn = Name & " " & "(" & win% & ")" & " " & Price

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

 

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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