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.
Hello everyone!
I'm new in Power BI and should to transform data in Power query for convinient analizing.
I need to have one column for date (years), one column for Units and one column for sales, EUR.
I tried to Unpivot columns, but didn't get the needed result.
Could you please advise some aproach?
Thank you in advance!
Here is the part od data.
Sku name Quarter 2019, Units 2019, EUR 2020, Units 2020, EUR
5_SKU Q1 253 825 0 0
5_SKU Q2 125 569 0 0
5_SKU Q3 89 425 0 0
5_SKU Q4 98 657 0 0
5_SKU Q1 0 0 124 985
5_SKU Q2 0 0 98 741
5_SKU Q3 0 0 74 695
5_SKU Q4 0 0 97 954
Solved! Go to Solution.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dY4xDoAgDEXv0pnBYgv0DE7GOBHi/W9hWwMxQQfeQF9/f63A17GdEGBHReRVWSIrF38tvJSoQB9ykm/F921GfyGkkKJInL8NHN927vF5btIVD8uEc5FuZMtIwnORkWFVhAlauwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Sku name" = _t, Quarter = _t, #"2019, Units" = _t, #"2019, EUR" = _t, #"2020, Units" = _t, #"2020, EUR" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Sku name", type text}, {"Quarter", type text}, {"2019, Units", Int64.Type}, {"2019, EUR", Int64.Type}, {"2020, Units", Int64.Type}, {"2020, EUR", Int64.Type}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Sku name", "Quarter"}, "Attribute", "Value"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Attribute.1", "Attribute.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Attribute.1", Int64.Type}, {"Attribute.2", type text}}),
#"Pivoted Column" = Table.Pivot(#"Changed Type1", List.Distinct(#"Changed Type1"[Attribute.2]), "Attribute.2", "Value", List.Sum)
in
#"Pivoted Column"
Copy and paste the full example into your advanced editor.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dY4xDoAgDEXv0pnBYgv0DE7GOBHi/W9hWwMxQQfeQF9/f63A17GdEGBHReRVWSIrF38tvJSoQB9ykm/F921GfyGkkKJInL8NHN927vF5btIVD8uEc5FuZMtIwnORkWFVhAlauwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Sku name" = _t, Quarter = _t, #"2019, Units" = _t, #"2019, EUR" = _t, #"2020, Units" = _t, #"2020, EUR" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Sku name", type text}, {"Quarter", type text}, {"2019, Units", Int64.Type}, {"2019, EUR", Int64.Type}, {"2020, Units", Int64.Type}, {"2020, EUR", Int64.Type}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Sku name", "Quarter"}, "Attribute", "Value"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Attribute.1", "Attribute.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Attribute.1", Int64.Type}, {"Attribute.2", type text}}),
#"Pivoted Column" = Table.Pivot(#"Changed Type1", List.Distinct(#"Changed Type1"[Attribute.2]), "Attribute.2", "Value", List.Sum)
in
#"Pivoted Column"
Copy and paste the full example into your advanced editor.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
10 | |
7 | |
6 | |
6 | |
6 |