cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
HieuNgo Frequent Visitor
Frequent Visitor

Pivot and Unpivot: How to Split 2 Value Metrics in a Column (Power Query in Power BI)

Hi, how do I split the Column "2 Value Measures" into 2 Columns, each has one measure? You can start from either photo 1 or photo 2. Thank you for your help!

 

Capture1.PNGCapture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Vitali87 Frequent Visitor
Frequent Visitor

Re: Pivot and Unpivot: How to Split 2 Value Metrics in a Column (Power Query in Power BI)

Hi there,

 

First, you need to make some sort of classification. I am not sure if the rest of the columns can be used for this, but I notice that the two measures are in a very different scale - hundreds of thousands and numbers below 10. So here's how, in two steps, you can achieve what you're looking for:

Step1: Categorize the Measures

Step 1 - categorization.jpg

 

Step 2: Select, in this order, the categorization column and the one with the measures and use the Pivot option in the Transform section 

Step 2 - Pivot the values.jpg

 

Done:

Final result.jpg

View solution in original post

2 REPLIES 2
Vitali87 Frequent Visitor
Frequent Visitor

Re: Pivot and Unpivot: How to Split 2 Value Metrics in a Column (Power Query in Power BI)

Hi there,

 

First, you need to make some sort of classification. I am not sure if the rest of the columns can be used for this, but I notice that the two measures are in a very different scale - hundreds of thousands and numbers below 10. So here's how, in two steps, you can achieve what you're looking for:

Step1: Categorize the Measures

Step 1 - categorization.jpg

 

Step 2: Select, in this order, the categorization column and the one with the measures and use the Pivot option in the Transform section 

Step 2 - Pivot the values.jpg

 

Done:

Final result.jpg

View solution in original post

HieuNgo Frequent Visitor
Frequent Visitor

Re: Pivot and Unpivot: How to Split 2 Value Metrics in a Column (Power Query in Power BI)

It works! Thank you very much, Vitali87

 

To categorize the measures, I used the M code:

= Table.AddColumn(#"Source", "Custom", each if Text.StartsWith([2 Value Measures], "$") then "Sales" else "Tax")

 

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Top Kudoed Authors
Users Online
Currently online: 139 members 1,696 guests
Please welcome our newest community members: