Forum Discussion

adamavix's avatar
adamavix
Regular Visitor
8 years ago
Solved

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}

3 Replies

    • adamavix's avatar
      adamavix
      Regular Visitor
      That worked perfectly (I’m new to power query) thank you.
  • Hi,

    I was about to ask whether there is a way to plot pivoted data (already in a table, for example, in an Excel worksheet) in Power BI as if they are unpivot data.  But then I saw this thread about the unpivot option in the query editor.

    This thread was started a few years ago, and I wonder if there is any new development in Power BI that will graph pivoted data as if they are not pivot.  By the way, I am using an older version of Power BI (May 2021 RS).  If that makes any difference.

     

    Thanks