cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
New Kudos Received Badges Coming

New Kudos Received Badges Coming

Kudos to you if you earned one of these! Check your inbox for a notification.

Microsoft Implementation for Communities Wins Award

Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (3,041)