Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
I would like to merge/combine 100+ values from a column. At the moment my column looks like this:
ColumnGames | Quantity |
Call of Duty | 2 |
Call of Duty (old) | 4 |
Battlefield | 2 |
Battlefield (old) | 6 |
Sims | 3 |
Sims (Old) | 3 |
My desired output column would look like this:
ColumnGames | Quantity |
Call of Duty Total | 6 |
Battlefield Total | 8 |
Sims Total | 6 |
I hope someone can help me with this. Thanks in advance!
Solved! Go to Solution.
Hi @DeBIe ,
As parry2k's suggestion, you may enter into Query Editor, select on the column [ColumnGames] , right click to choose option "Replace Values", set like below, click button "Close & Apply". Then you may use Table visual to display the two fields, which has a Sum aggregation for the [Quantity].
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @DeBIe ,
As parry2k's suggestion, you may enter into Query Editor, select on the column [ColumnGames] , right click to choose option "Replace Values", set like below, click button "Close & Apply". Then you may use Table visual to display the two fields, which has a Sum aggregation for the [Quantity].
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you all for your time and feedback. @v-xicai your solution worked out best for me. Also, the easiest to implement.
Hi @DeBIe ,
You can do this in Power Query as follows:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wck7MyVHIT1NwKS2pVNJRMlKK1UEVVNDIz0nRBEqZgKWcEktKclLTMlNzUuDKkcTgqs3AMsGZucVAjjGco6DhD5EHCsUCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ColumnGames = _t, Quantity = _t]),
chgAllTypes = Table.TransformColumnTypes(Source,{{"ColumnGames", type text}, {"Quantity", Int64.Type}}),
splitByBracket = Table.SplitColumn(chgAllTypes, "ColumnGames", Splitter.SplitTextByEachDelimiter({"("}, QuoteStyle.Csv, false), {"ColumnGames", "ColumnGames.2"}),
remSplit2 = Table.RemoveColumns(splitByBracket,{"ColumnGames.2"}),
trimColumnGames = Table.TransformColumns(remSplit2,{{"ColumnGames", Text.Trim, type text}}),
groupColumnGames = Table.Group(trimColumnGames, {"ColumnGames"}, {{"Quantity", each List.Sum([Quantity]), type number}})
in
groupColumnGames
In Power Query, go to New Source > Blank Query, then go to Advanced Editor and paste in my code above over the default query code. You can then follow the steps I took to complete this.
I have assumed that the only difference between names is the addition of "(Old)" in all cases, as I've split your [columnGames] based on the "(" portion of it.
Pete
Proud to be a Datanaut!
@DeBIe in power query, replace (old) with "" (no space) and this will group all games together. just close and apply and in visual you can now use sum by columngames
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos 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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |