Forum Discussion

NickDSL's avatar
NickDSL
Helper I
2 years ago
Solved

Pivoting Columns into one row

I have data like below.

ProductsDateValue
11/1/202310
21/1/202310
11/2/202320
21/2/202320
11/3/202330
21/3/202330
11/4/202340
21/4/202340
11/5/202350
21/5/202350

 

I'm trying to pivot into into this table below.

Date12
1/1/20231010
1/2/20232020
1/3/20233030
1/4/20234040
1/5/20235050

 

When I do Pivot columns I get this below:

Date12
1/1/202310null
1/1/2023null10
1/2/202320null
1/2/2023null20
1/3/202330null
1/3/2023null30
1/4/202340null
1/4/2023null40
1/5/202350null
1/5/2023null50

 

There are other columns and this is a heavily simplified version as I cannot share the exact data.

 

If anyone has any tips or trick on how I can get to my goal (imaged below here again) I would greatly appreciate it!

Date12
1/1/20231010
1/2/20232020
1/3/20233030
1/4/20234040
1/5/20235050
  • = Table.Pivot(Table.TransformColumnTypes(Source, {{"Products", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(Source, {{"Products", type text}}, "en-US")[Products]), "Products", "Value", List.Sum)

1 Reply

  • = Table.Pivot(Table.TransformColumnTypes(Source, {{"Products", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(Source, {{"Products", type text}}, "en-US")[Products]), "Products", "Value", List.Sum)