Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
My input value is like this
Product Quality |
apple_high |
apple_medium,apple_low,apple_high |
apple_low,orange_high,mango_low |
mango_high,orange_medium |
orange_low,mango_low |
I wanted my output to look like the below table
Product | High | Medium | low |
apple | 2 | 1 | 2 |
orange | 1 | 1 | 1 |
mango | 1 | 0 | 2 |
Need some help on how to create a measure for this quer
Solved! Go to Solution.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSiwoyEmNz8hMz1CK1YFxc1NTMktzdSCcnPxyHayqQBL5RYl56RAZnVwgMx8kClYD4YEloIogpoIloSIgE5B0xQIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Product Quality" = _t]),
Split = Table.TransformColumns(Source, {"Product Quality", each Table.FromRows(List.Transform(Text.Split(_,","), each Text.Split(Text.Trim(_), "_")), {"Brand", "Quality"})}),
#"Expanded Product Quality" = Table.ExpandTableColumn(Split, "Product Quality", {"Brand", "Quality"}, {"Brand", "Quality"}),
#"Duplicated Column" = Table.DuplicateColumn(#"Expanded Product Quality", "Brand", "Brand - Copy"),
#"Pivoted Column" = Table.Pivot(#"Duplicated Column", List.Distinct(#"Duplicated Column"[Quality]), "Quality", "Brand - Copy", List.Count)
in
#"Pivoted Column"
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSiwoyEmNz8hMz1CK1YFxc1NTMktzdSCcnPxyHayqQBL5RYl56RAZnVwgMx8kClYD4YEloIogpoIloSIgE5B0xQIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Product Quality" = _t]),
Split = Table.TransformColumns(Source, {"Product Quality", each Table.FromRows(List.Transform(Text.Split(_,","), each Text.Split(Text.Trim(_), "_")), {"Brand", "Quality"})}),
#"Expanded Product Quality" = Table.ExpandTableColumn(Split, "Product Quality", {"Brand", "Quality"}, {"Brand", "Quality"}),
#"Duplicated Column" = Table.DuplicateColumn(#"Expanded Product Quality", "Brand", "Brand - Copy"),
#"Pivoted Column" = Table.Pivot(#"Duplicated Column", List.Distinct(#"Duplicated Column"[Quality]), "Quality", "Brand - Copy", List.Count)
in
#"Pivoted Column"
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Check out the July 2025 Power BI update to learn about new features.