Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I have 3 columns are Area, country and code and those three columns data type is mixed (Text and Number together)
I would like to concatenate country and code column together in column without duplication based on the area column.
I am looking for new calculated column option.
AREA | COUNTRY | CODE | RESULT |
DD1 | IND | 001 | IND/001,PAK/008 |
DD1 | IND | 001 | IND/001,PAK/008 |
DD1 | IND | 001 | IND/001,PAK/008 |
DD1 | IND | 001 | IND/001,PAK/008 |
DD1 | PAK | 008 | IND/001,PAK/008 |
DD1 | PAK | 008 | IND/001,PAK/008 |
DD2 | SRI | DMK | SRI/DMK |
DD3 | AUS | 101 | AUS/101,USA/234 |
DD3 | AUS | 101 | AUS/101,USA/234 |
DD3 | USA | 234 | AUS/101,USA/234 |
DD3 | USA | 234 | AUS/101,USA/234 |
I am applying the following DAX
Solved! Go to Solution.
@Saxon10 try this code to add a calculated column
Result1 =
VAR __t =
SUMMARIZE (
FILTER ( 'Table', 'Table'[AREA] = EARLIER ( 'Table'[AREA] ) ),
'Table'[AREA], 'Table'[COUNTRY], 'Table'[CODE],
"@Country", CALCULATE ( MAX ( 'Table'[COUNTRY] ) ),
"@Code", CALCULATE ( MAX ( 'Table'[CODE] ) )
)
RETURN
CONCATENATEX ( __t , [@Country] & "/" & [@Code], "," )
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi,
This M code works
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnExVNJR8vRzAZIGBoZKsTrUEAtw9AaLWeARMwLygoM8gaSLrzdUzBjIcwwNBpKGcPNwiYUGOwJJI2MT7GKxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Area = _t, Country = _t, Code = _t]),
#"Merged Columns" = Table.CombineColumns(Source,{"Country", "Code"},Combiner.CombineTextByDelimiter("/", QuoteStyle.None),"Merged"),
#"Grouped Rows" = Table.Group(#"Merged Columns", {"Area"}, {{"All Merged", each Text.Combine(List.Distinct([Merged]), ", "), type text}}),
Joined = Table.Join(#"Merged Columns", "Area", #"Grouped Rows", "Area"),
#"Split Column by Delimiter" = Table.SplitColumn(Joined, "Merged", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), {"Merged.1", "Merged.2"}),
#"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Area", type text}, {"Merged.1", type text}, {"Merged.2", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Merged.1", "Country"}, {"Merged.2", "Code"}})
in
#"Renamed Columns"
Hope this helps.
Hi,
This can be done quite easily in the Query Editor. Are you interested in a Query Editor solution?
Hi,
Thanks for your reply.
Yes, Please. Sometimes I have huge data so power query will help to get the quick results.
Hi,
This M code works
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnExVNJR8vRzAZIGBoZKsTrUEAtw9AaLWeARMwLygoM8gaSLrzdUzBjIcwwNBpKGcPNwiYUGOwJJI2MT7GKxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Area = _t, Country = _t, Code = _t]),
#"Merged Columns" = Table.CombineColumns(Source,{"Country", "Code"},Combiner.CombineTextByDelimiter("/", QuoteStyle.None),"Merged"),
#"Grouped Rows" = Table.Group(#"Merged Columns", {"Area"}, {{"All Merged", each Text.Combine(List.Distinct([Merged]), ", "), type text}}),
Joined = Table.Join(#"Merged Columns", "Area", #"Grouped Rows", "Area"),
#"Split Column by Delimiter" = Table.SplitColumn(Joined, "Merged", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), {"Merged.1", "Merged.2"}),
#"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Area", type text}, {"Merged.1", type text}, {"Merged.2", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Merged.1", "Country"}, {"Merged.2", "Code"}})
in
#"Renamed Columns"
Hope this helps.
Thanks for your help.
You are welcome.
@Saxon10 try this code to add a calculated column
Result1 =
VAR __t =
SUMMARIZE (
FILTER ( 'Table', 'Table'[AREA] = EARLIER ( 'Table'[AREA] ) ),
'Table'[AREA], 'Table'[COUNTRY], 'Table'[CODE],
"@Country", CALCULATE ( MAX ( 'Table'[COUNTRY] ) ),
"@Code", CALCULATE ( MAX ( 'Table'[CODE] ) )
)
RETURN
CONCATENATEX ( __t , [@Country] & "/" & [@Code], "," )
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thanks for your reply and help.
I will check formula and update the feedback to you.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
132 | |
76 | |
53 | |
38 | |
37 |
User | Count |
---|---|
200 | |
81 | |
70 | |
55 | |
44 |