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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
adamavix
Regular Visitor

Pivoted data with custom clustered column chart

For a very simple example, say I have table with rows:

 

{name = a, M1 = 10, M2 = 20},

{name = a, M1 = 15, M2 = 10},

{name = b, M1 = 15, M2 = 10}

 

So obviously we can combine this (say with sum) to just give us:

 

{name = a, M1 = 25, M2 = 30}

{name = b, M1 = 15, M2 = 10}

 

When I plot this (say clustered column chart), it will have names (a and b) on the axis, and the values of M1/M2 for each index as clustered column bars. For example, name "a" will be on the axis and have two bars for M1 = 25, M2 = 30. 

 

 

My question is, is it possible to flip this to be M1 on the axis with two bars with a = 25 and b = 15? I can make a complicated function that regoups M1/M2 using power query m, but it is slow and I think there must be a simpler way or that I am not approaching this the correct way. Essentially, I can make the table below and get this to work, but it is not optimal. 

 

{month = M1, a = 25, b = 15}

{month = M2, a = 30, b = 10}

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

@adamavix,

 

The simple way is to use unpivot columns in Query Editor.

Community Support Team _ Sam Zha
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-chuncz-msft
Community Support
Community Support

@adamavix,

 

The simple way is to use unpivot columns in Query Editor.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

That worked perfectly (I’m new to power query) thank you.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.