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.
This seems kind of unique, but may not be. I'm in a new role and learning Power BI.
I have a table of information coming from a dataflow set to automatically update. I need to use this as a dimension table, however some items have multiple entries (because of multiple accessories) and I need to clean the data in order to reach a one to many relationship.
Basically I am looking to have the 2nd and 3rd Accessory feed into additional columns.
To simplify, this is the start:
Item | Accessory |
Item 1 | Accessory 1A |
Item 2 | Accessory 2A |
Item 2 | Accessory 2B |
Item 3 | Accessory 3A |
Item 3 | Accessory 3B |
Item 3 | Accessory 3C |
Item 4 | Accessory 4A |
Item 5 | Accessory 5A |
Item 5 | Accessory 5B |
Item 6 | Accessory 6A |
and this is my desired result:
Item | 1st Acc | 2nd Acc | 3rd Acc |
Item 1 | Accessory 1A | ||
Item 2 | Accessory 2A | Accessory 2B | |
Item 3 | Accessory 3A | Accessory 3B | Accessory 3C |
Item 4 | Accessory 4A | ||
Item 5 | Accessory 5A | Accessory 5B | |
Item 6 | Accessory 6A |
Thanks for the help in advance!
Solved! Go to Solution.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8ixJzVUwVNJRckxOTi0uzi+qVDB0VIrVgcoYocgY4ZZxQsgYo8gYO+KUwa3HGSFjgiJjgmSaKYqMKW4ZJHvMUGTMgHpiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Item = _t, Accessory = _t]),
#"Grouped Rows" = Table.Group(Source, {"Item"}, {{"ar", each Table.Transpose(Table.SelectColumns(_, {"Accessory"}))}}),
#"Expanded ar" = Table.ExpandTableColumn(#"Grouped Rows", "ar", {"Column1", "Column2", "Column3"}, {"Acc1", "Acc2", "Acc3"})
in
#"Expanded ar"
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("i45W8ixJzVUwVNJRckxOTi0uzi+qVDB0VIrVgcoYocgY4ZZxQsgYo8gYO+KUwa3HGSFjgiJjgmSaKYqMKW4ZJHvMUGTMgHpiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Item = _t, Accessory = _t]),
#"Grouped Rows" = Table.Group(Source, {"Item"}, {{"ar", each Table.Transpose(Table.SelectColumns(_, {"Accessory"}))}}),
#"Expanded ar" = Table.ExpandTableColumn(#"Grouped Rows", "ar", {"Column1", "Column2", "Column3"}, {"Acc1", "Acc2", "Acc3"})
in
#"Expanded ar"
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! |
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |