Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Why my data is totally wrong after the unpivoted the selected columns in Power Query

Dear all, 

I have the trade data from January until December in which the months (Jan-Dec) are the header. How do I make the header as a month's slicer ? Is it using the pivot and unpivot ? , but I have 9,910 rows of each columns. I cant provide the PBIX file since it is confidential. 

I tried to unpivoted the selected column (all months), it works but the total(sum) of import and export changed after I unpivoted the selected column and the data become totally wrong. The import data should be 17bil, but it become 2 tril after unpivoted the selected columns

DATA TRADE QUESTION.png

 

 

 

 

 

 

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You need to use pivot first and then unpivot.

1.Select the two columns and then click "Unpivot other columns".

vstephenmsft_1-1685338566034.png

vstephenmsft_2-1685338967366.png

2.Split the Attribute column with " ".

vstephenmsft_3-1685339001940.png

vstephenmsft_4-1685339016005.png

3.Select the Attribute.1 column and click Pivot Column.

vstephenmsft_5-1685339030456.png

vstephenmsft_6-1685339057836.png

vstephenmsft_7-1685339067102.png

Now you have a column with month name, a column with QTY and a column with VAL.

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

View solution in original post

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You need to use pivot first and then unpivot.

1.Select the two columns and then click "Unpivot other columns".

vstephenmsft_1-1685338566034.png

vstephenmsft_2-1685338967366.png

2.Split the Attribute column with " ".

vstephenmsft_3-1685339001940.png

vstephenmsft_4-1685339016005.png

3.Select the Attribute.1 column and click Pivot Column.

vstephenmsft_5-1685339030456.png

vstephenmsft_6-1685339057836.png

vstephenmsft_7-1685339067102.png

Now you have a column with month name, a column with QTY and a column with VAL.

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

Anonymous
Not applicable

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors