Forum Discussion

inglexjc's avatar
inglexjc
Post Patron
1 year ago

bar graph format

How do I get Bar Graph to have more space and line up with it's data source?

What I have: 

Spacing and line up I'm wanting:

 

11 Replies

  • Deku's avatar
    Deku
    Super User

    Swap from clustered to stacked bar chart, and move the field in the legend to categories 

      • Deku's avatar
        Deku
        Super User

        create a table like this

        yAxis = 
        DATATABLE(
            "measure", STRING,
            {{"a"}, {"b"}, {"c"}}
        )

         

        and a measure

        xAxis = 
        SWITCH(
            SELECTEDVALUE( 'yAxis'[measure] )
            ,"a", [a],
            "b", [b],
            "c", [c]
        )

        and add to a stacked bar chart

         

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi inglexjc,

     

    • When using multiple measures in a bar chart, Power BI places all the bars on the same axis line. This means the bars are treated as different series within a single category, resulting in no vertical spacing between them and misalignment with category labels.
    • To achieve the desired layout—where each bar appears on its own row with proper spacing—we need to restructure the data by unpivoting the measures into a single column. This transforms each measure into a category, allowing Power BI to plot one bar per row, apply vertical spacing (via inner padding), and align bars correctly with their labels.

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it !

     

    Regards,

    Vinay

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi inglexjc,

     

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
    If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

     

    Regards,
    Vinay Pabbu

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi @inglexjc,

       

      As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
      If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

       

      Regards,
      Vinay Pabbu