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

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
Anonymous
Not applicable

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
Anonymous
Not applicable

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

Anonymous
Not applicable

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
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