Forum Discussion

HamidBee's avatar
HamidBee
Icon for Power Participant rankPower Participant
4 years ago
Solved

How do I create a bar chart with the column headers showing along the axis (no transposing)?

How do I create a bar chart with the column headers showing along the axis (no transposing in power query)?. I have created an example table below:   The bar chart should show the five items ...
  • bcdobbs's avatar
    4 years ago

    If you really can't transpose it (wondered if you could use a calculated table and effectively create a copy of the data) then you could do the following:

    1) Create a disconected table that just contains the values you want on the x-axis:

    2) Write a measure like

    BarValues = 
        SWITCH ( 
            SELECTEDVALUE ( 'Axis'[X-Axis] ),
            "A", SUM ( 'DataTable'[A] ),
            "B", SUM ( 'DataTable'[B] ),
            "C", SUM ( 'DataTable'[C] ),
            "D", SUM ( 'DataTable'[D] )
        )

     

    Put the disconnected table column in axis and the measure in values: