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 have a table which looks like this but in reality has 20 Atr columns
Customer | Atr A1 | Atr B1 | Atr C1 | Atr A2 | Atr B2 | Atr C2 | Atr A3 | Atr B3 | Atr C3 |
A | Purple | Iron | kids | Yellow | Plastic | Teens | Pink | Paper | Senior |
B | Green | Plastic | Adult | Black | Plastic | Adult | White | Wood | Kids |
And I want it to look like this
Customer | Atr A | Atr B | Atr C |
A | Purple | Iron | Kids |
A | Yellow | Plastic | Teens |
A | Pink | Paper | Senior |
B | Green | Plastic | Adult |
B | Black | Plastic | Adult |
B | White | Wood | Kids |
Have you got any Idea how to fix this?
Solved! Go to Solution.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY5BCoQwDEXvkrWX0M0gbgQFGUoXxQYmNDQSK17fZCnM6v3wfuCHAD10MF96MFoYVaqhUD4NX2SW2z2ns9FuaUWsrmaqxZEOVOOClUQhdgEGOz9qtddfny9uxoHTXv6a7UfNJ2wi2TD5hBgf", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Customer = _t, #"Atr A1" = _t, #"Atr B1" = _t, #"Atr C1" = _t, #"Atr A2" = _t, #"Atr B2" = _t, #"Atr C2" = _t, #"Atr A3" = _t, #"Atr B3" = _t, #"Atr C3" = _t]),
Transformed = let cols = Table.ToColumns(Source), hdr = cols{0} in Table.Combine(List.Transform(List.Split(List.Skip(cols),3), each Table.FromColumns({hdr} & _)))
in
Transformed
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("bY5BCoQwDEXvkrWX0M0gbgQFGUoXxQYmNDQSK17fZCnM6v3wfuCHAD10MF96MFoYVaqhUD4NX2SW2z2ns9FuaUWsrmaqxZEOVOOClUQhdgEGOz9qtddfny9uxoHTXv6a7UfNJ2wi2TD5hBgf", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Customer = _t, #"Atr A1" = _t, #"Atr B1" = _t, #"Atr C1" = _t, #"Atr A2" = _t, #"Atr B2" = _t, #"Atr C2" = _t, #"Atr A3" = _t, #"Atr B3" = _t, #"Atr C3" = _t]),
Transformed = let cols = Table.ToColumns(Source), hdr = cols{0} in Table.Combine(List.Transform(List.Split(List.Skip(cols),3), each Table.FromColumns({hdr} & _)))
in
Transformed
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 |
---|---|
97 | |
95 | |
77 | |
72 | |
65 |
User | Count |
---|---|
136 | |
109 | |
104 | |
82 | |
73 |