Forum Discussion
showing data in matrix
- 6 years ago
Hello Anonymous
if I got you right you need the pivot-function. Check out this solution
let Source = #table ( {"Company","Week","Value"}, { {"A","Week 1","1"}, {"A","Week 2","2"}, {"A","Week 3","3"}, {"A","Week 4","4"}, {"B","Week 1","5"}, {"B","Week 2","6"}, {"B","Week 3","7"}, {"B","Week 4","8"}, {"B","Week 5","9"}, {"C","Week 1","10"}, {"C","Week 2","11"}, {"C","Week 3","12"}, {"C","Week 4","13"} } ), ChangedType = Table.TransformColumnTypes(Source,{{"Value", Int64.Type}}), Pivot = Table.Pivot(ChangedType, List.Distinct(ChangedType[Week]), "Week", "Value", List.Sum) in PivotCopy paste this code to the advanced editor in a new blank query to see how the solution works. If this solution fits your need, copy and past a part of it and implement it in your query or just select the week-column and select Transform -> Pivot column. In my solution i selected SUM for the aggregation. Change this if another calculation is needed (in case of multiple rows on Company/week-level.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello Anonymous
if I got you right you need the pivot-function. Check out this solution
let
Source = #table
(
{"Company","Week","Value"},
{
{"A","Week 1","1"}, {"A","Week 2","2"}, {"A","Week 3","3"}, {"A","Week 4","4"}, {"B","Week 1","5"}, {"B","Week 2","6"}, {"B","Week 3","7"}, {"B","Week 4","8"},
{"B","Week 5","9"}, {"C","Week 1","10"}, {"C","Week 2","11"}, {"C","Week 3","12"}, {"C","Week 4","13"}
}
),
ChangedType = Table.TransformColumnTypes(Source,{{"Value", Int64.Type}}),
Pivot = Table.Pivot(ChangedType, List.Distinct(ChangedType[Week]), "Week", "Value", List.Sum)
in
Pivot
Copy paste this code to the advanced editor in a new blank query to see how the solution works. If this solution fits your need, copy and past a part of it and implement it in your query or just select the week-column and select Transform -> Pivot column. In my solution i selected SUM for the aggregation. Change this if another calculation is needed (in case of multiple rows on Company/week-level.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy