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.
Hello,
Please refer to the attached screenshot. I am not sure how to best prepare this data for creating Visuals. I guess I have to create on column State with the data from the first Row, and one other column L-O with the data from the second Row. I tried different transformation steps but no luck.
Any ideas please
Thank you
Sabedin
Solved! Go to Solution.
You should find sth on this blog about doing this with the UI.
But I prefer a formula-solution (for performance-reasons, especially if your data is large):
let // Replace this with your source-data
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtJRcgRiJyB2VorViVZySSxJBXJ8EvNSEJRzfl4JWNbAUA+IjAwMzYGihkBsBMTGECkjZCkDkByIMDaAyBqjyEKkIfJABbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Spalte1 = _t, Spalte2 = _t, Spalte3 = _t, Spalte4 = _t]), Rename = Table.RenameColumns(Source, List.Transform(Table.ColumnNames(Source), each {_, Text.Combine({Record.Field(Source{0}, _), Record.Field(Source{1}, _)}, "--")})), RemoveTopTwo = Table.Skip(Rename,2), // Depending on how the blanks in your first fields come in, you might need to chang {"--DATE"} to {"DATE"}
UnpivotOthers = Table.UnpivotOtherColumns(RemoveTopTwo, {"--DATE"}, "Attribute", "Value"), Split = Table.SplitColumn(UnpivotOthers,"Attribute",Splitter.SplitTextByDelimiter("--", QuoteStyle.Csv),{"Country", "Category"}) in Split
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
You should find sth on this blog about doing this with the UI.
But I prefer a formula-solution (for performance-reasons, especially if your data is large):
let // Replace this with your source-data
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtJRcgRiJyB2VorViVZySSxJBXJ8EvNSEJRzfl4JWNbAUA+IjAwMzYGihkBsBMTGECkjZCkDkByIMDaAyBqjyEKkIfJABbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Spalte1 = _t, Spalte2 = _t, Spalte3 = _t, Spalte4 = _t]), Rename = Table.RenameColumns(Source, List.Transform(Table.ColumnNames(Source), each {_, Text.Combine({Record.Field(Source{0}, _), Record.Field(Source{1}, _)}, "--")})), RemoveTopTwo = Table.Skip(Rename,2), // Depending on how the blanks in your first fields come in, you might need to chang {"--DATE"} to {"DATE"}
UnpivotOthers = Table.UnpivotOtherColumns(RemoveTopTwo, {"--DATE"}, "Attribute", "Value"), Split = Table.SplitColumn(UnpivotOthers,"Attribute",Splitter.SplitTextByDelimiter("--", QuoteStyle.Csv),{"Country", "Category"}) in Split
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
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 |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |