Reply
Frequent Visitor
Posts: 5
Registered: ‎07-25-2018
Accepted Solution

pivoting table

 I would require to pivot the following table

Capture.PNG

 

On Power BI page I would need to see data as follows:

 

From Date extract Year Month  for example Aug-18, Sept-18, Oct-18, Nov.-18, Dec-18, Jan-19

There is always 12 months of data I am showing however the date is fluctuating.  I could start from Aug or Sept or any other month.  It should sort date ascending.

Qty is total per month per product.

Here is an  example on how it should look like in a table, I am not sure on how to setup the Pivot ? and which visualization tool I should use.  Thanks

 

 

Capture1.PNG

 


Accepted Solutions
Community Support Team
Posts: 2,773
Registered: ‎03-15-2018

Re: pivoting table

[ Edited ]

Hi @patyk

If your purpose for pivoting table is just to show a visual like your screenshot, you could use the Matrix chart.

Before add columns to the Field of Matrix, you need to sort the "date" column by ascending, then change the date format to "MMMM yyyy".

11.png

 

If you need to pivot the table to change its structure, you could go to Edit queries

1. sort the date column

2.select "date" column, "pivot column"

14.png

3.replace values

replace "null" with 0

16.png

 

 

 

Best Reagrds

Maggie

View solution in original post


All Replies
Community Support Team
Posts: 2,773
Registered: ‎03-15-2018

Re: pivoting table

[ Edited ]

Hi @patyk

If your purpose for pivoting table is just to show a visual like your screenshot, you could use the Matrix chart.

Before add columns to the Field of Matrix, you need to sort the "date" column by ascending, then change the date format to "MMMM yyyy".

11.png

 

If you need to pivot the table to change its structure, you could go to Edit queries

1. sort the date column

2.select "date" column, "pivot column"

14.png

3.replace values

replace "null" with 0

16.png

 

 

 

Best Reagrds

Maggie

Frequent Visitor
Posts: 5
Registered: ‎07-25-2018

Re: pivoting table

Sorry I can't really use matrix because when exporting to Excell it does not export in pivot format.  Needs to export to excell in the exact view?

 

Thanks

Community Support Team
Posts: 2,773
Registered: ‎03-15-2018

Re: pivoting table

Hi @patyk

For your requirement, you could consider my sencond method, this would change the table structure, then you just add these columns to a Table visual, then you could export it to excel with the structure as you expected.

 

Best Regards

Maggie