Forum Discussion
Pivot Year Please Help
- 6 years ago
netanel
You don't need to do any transformation to get the data presented in the layout you wanted. Just add an index column in Power Query and insert a Matrix Visual then drop Year in Column, Index in Row, and Amount in Value, Done.
Please Check this file: https://1drv.ms/u/s!AmoScH5srsIYgYFhaaJI141dwgVkhg?e=4rap1Z
Mark this reply as a solution if I answered your question
Hi,
If you want to do it in Power Query, Load your table to Power Query (It's Table3 in my example) having Year and Amount as columns. Go to Advanced Editor clear existing codes and paste the code I shared.
let
Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
#"Duplicated Column" = Table.DuplicateColumn(Source, "Amount", "Amount - Copy"),
#"Added Index" = Table.AddIndexColumn(#"Duplicated Column", "Index", 0, 1),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Added Index", {{"Year", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Added Index", {{"Year", type text}}, "en-US")[Year]), "Year", "Amount - Copy", List.Sum),
#"Reordered Columns" = Table.ReorderColumns(#"Pivoted Column",{"Index", "2017", "2018", "2019", "Amount"}),
#"Removed Columns" = Table.RemoveColumns(#"Reordered Columns",{"Index"})
in
#"Removed Columns"
Did I answer your question? Mark my post as a solution!
Hi
Sorry but I didn't understand what to do?
The formula is a bit unclear to me, and where to pot that in Query?
- Fowmy6 years agoSuper User
I have attached the file for you to learn and understand:
https://1drv.ms/x/s!AmoScH5srsIYgYFctF_wc5uOXEjf8g?e=eYJEpIThis was done in Power Query which is available in Power BI and Excel 2016+Above. Refer some videos to learn more.
https://www.youtube.com/channel/UCKwBEguA8IlBubIobaOormgDid I answer your question? Mark my post as a solution!