Forum Discussion
Mariollo
1 year agoHelper I
Problem with pivoting table
Hello everyone, I have a table in Power BI that looks like this: Week Start Users New Amount 01/01/2024 9,994 1,459 109,365 08/01/2024 9,568 1,362 90,593 15/01/2024 10,392 1,54...
- 1 year ago
Guys, forget my question.
Enabling this option solved all my issues for now:
Greg_Deckler
1 year agoCommunity Champion
Mariollo That's a transpose, not a pivot. You can do the following although that is generally not the form that you want for data analysis in Power BI.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vcy/CgIxDAbwV5HMAfOn6TWjL+Ai4lA6OHQSFe5O7vVt6+JByEc+fiRnuNX6OFzW+7wCwnWp89LyXLe2T8/357VCwQzExzZCElrv6N6TMZj3JEeN9oNpBy2mATVKvwnNdTi2P8eE6jKghf4xKbLygCJ7SEEHnMIoJkPXCKV8AQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
#"Transposed Table" = Table.Transpose(Source),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Week Start", type text}, {"01/01/2024", Int64.Type}, {"08/01/2024", Int64.Type}, {"15/01/2024", Int64.Type}, {"22/01/2024", Int64.Type}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Week Start", "Type"}})
in
#"Renamed Columns"