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, I have a column of text separated by a Comma, e.g.
Column :
good,bad
good,worst
worst,
etc etc
i want the result would be like this:
good = 2
bad = 1
worst = 2
i have referred this link (https://community.powerbi.com/t5/Desktop/Counting-how-many-times-a-word-is-in-a-column/m-p/304977#M1... i am not able to understand properly..as am new to power bi ...
Solved! Go to Solution.
Hi @Gokul,
You can enter to query editor to split your words and use group function to calculate count of each word.
Full query:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSs/PT9FJSkxRitWBcsrzi4pLwFwwS0cpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column", type text}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Detail", each Text.Split([Column],",")), #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Detail"), #"Filtered Rows" = Table.SelectRows(#"Expanded Custom", each [Detail] <> null and [Detail] <> ""), #"Grouped Rows" = Table.Group(#"Filtered Rows", {"Detail"}, {{"Count", each Table.RowCount(_), type number}}) in #"Grouped Rows"
Regards,
Xiaoxin Sheng
Hi @Gokul,
You can enter to query editor to split your words and use group function to calculate count of each word.
Full query:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSs/PT9FJSkxRitWBcsrzi4pLwFwwS0cpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column", type text}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Detail", each Text.Split([Column],",")), #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Detail"), #"Filtered Rows" = Table.SelectRows(#"Expanded Custom", each [Detail] <> null and [Detail] <> ""), #"Grouped Rows" = Table.Group(#"Filtered Rows", {"Detail"}, {{"Count", each Table.RowCount(_), type number}}) in #"Grouped Rows"
Regards,
Xiaoxin Sheng
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 | |
100 | |
76 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |