Forum Discussion

caplogic's avatar
caplogic
Icon for Helper II rankHelper II
3 months ago
Solved

How to Expand Stacked Bars To fill Visual Pt2

I have a Clustered Stack column visual which has a number of columns in the middle of the visuals, see image

 

You will notice the columns are in the centre of the visual.

 

I would like help formatting the columns such that they spread across the entire visual similar to the following

 

 

Can someone please show me how to format the visual to accomplish expanding the columns across the page/visual. I think I might need to do some kind of padding, but not sure.

 

 

16 Replies

  • Hi caplogic ,

     

    To get this instead of placing the column on the legend place it on the x-axis should give expected look.

  • Step-by-step solution:

    1. Click on your Clustered Column visual to select it.

    2. Go to the Format your visual pane (paint roller icon).

    3. Expand X-axis.

    4. Look for these key settings and adjust them:

      • Minimum category width — Increase this value (e.g., start with 50–150 pixels). This forces each column group to take up more space and helps spread them out.
      • Inner padding — Decrease this percentage (try 10% → 5% → 0%). Lower inner padding makes the individual columns wider and reduces the gap between them.
      • Maximum size (if available) — You can also increase this.

    Pro tip: Try setting Minimum category width first — this is usually the most effective control when columns are squeezed in the center.

    Quick Test Order (Recommended):

    1. Set Inner padding to 0% or 5%.
    2. Increase Minimum category width until the columns nicely fill the visual.
    3. Fine-tune as needed.

     

    • caplogic's avatar
      caplogic
      Icon for Helper II rankHelper II

      Hi pcoley I tried your suggestion, but it didn't have a great impact.

       

       

       

       

       

      • pcoley's avatar
        pcoley
        Icon for Super User rankSuper User

        This happens because Power BI squeezes the column groups into the center by default if you have multiple measures on the Y-axis and probably only a few (or none) categories on the X-axis. 

         

        please try whit the  bigger value for the x-axis "Minimum category width"; and play with the width of the Column>Layout>"Space between series" and the position of the Legend (placed to the left or right side).

         

         

         

    • caplogic's avatar
      caplogic
      Icon for Helper II rankHelper II

      Hi pcoley thanks again for getting in touch,

       

      I tried your suggestion as it appeared the easiest of the solutions presented here, but I didn't get much out of it, see below

       

       

       

  • Another possible solution: 

     

    Switch the field between X-axis and Legend (or vice-versa): this will change how Power BI lays out the visual, and it can make the columns spread better in some cases — especially if you currently have a field with few unique values on the X-axis.

    When it works well:

    • If you move your main categorical field (e.g. Business Type) to X-axis, and put the measures (Gross, Net, etc.) in the Values field only (without Legend), you often get better spreading.
    • Or vice versa: sometimes having the breakdown on Legend and a date/month on X-axis spreads things out more.
    • MFelix's avatar
      MFelix
      Icon for Super User rankSuper User

      Hi  caplogic ,

       

      Since you are using several measures this automatically joins them has an histogram.

       

      Adding to the great answers that pcoley  gave you can also do the folllowing:

      • Add a disconnect table with the name of the measures

       

      • Add a new measure with the following code:
      Chart Value = 
              SWITCH(SELECTEDVALUE(KPIS[Sort]),
              1, SUM(AcctHdlrAnalyisByPlyAndBdrRoot[TotalGrossPremium]),
              2, SUM(AcctHdlrAnalyisByPlyAndBdrRoot[TotalNetPremium]),
              3, SUM(AcctHdlrAnalyisByPlyAndBdrRoot[AverageGrossPremium]),
              4, SUM(AcctHdlrAnalyisByPlyAndBdrRoot[AverageNetPremium]))

      Now use the Measure column on X-axis and the Chart Value measure on the values

       

       

      If you allow me I suggest that you check the best practices for the usage of implicit measures vs explicit measures:

       

      https://data-mozart.com/understanding-explicit-vs-implicit-measures-in-power-bi/

       

      • caplogic's avatar
        caplogic
        Icon for Helper II rankHelper II

        Hi MFelix this looks like an ideal solution, but it's very advanced for someone like me that has very littlel experience with Power BI. I have not even heard of the concept of a disconnect table.

         

         

    • pcoley's avatar
      pcoley
      Icon for Super User rankSuper User

      caplogic 
      I suggest changing a little bit your model:
      1. In power query add an "unpivot" and a "change data type" steps :

      let
        Source = Sql.Database("XPS-18-LANDELLS", "latitude"), 
        dbo_AcctHdlrAnalyisByPlyAndBdrRoot = Source
          {[Schema = "dbo", Item = "AcctHdlrAnalyisByPlyAndBdrRoot"]}
          [Data], 
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(
          dbo_AcctHdlrAnalyisByPlyAndBdrRoot, 
          {
            "Account Handler", 
            "BusinessType", 
            "BinderRootStatus", 
            "BinderType", 
            "NumberOfPolicies", 
            "BDXDate", 
            "Coverholder"
          }, 
          "Attribute", 
          "Value"
        ), 
        #"Changed Type" = Table.TransformColumnTypes(#"Unpivoted Columns", {{"Value", type number}})
      in
        #"Changed Type"

       

       

      Create an explicit measur (best practices: do not use implicit fields directly where you want measures):

      SumValues = sum(AcctHdlrAnalyisByPlyAndBdrRoot[Value])

      Finally in the Clustered Column Chart use the Categories (created in the UnPivot step in powerquery) as the x-axis field, and use SumValues Measure in the y-axis values:

       

       
       

      • caplogic's avatar
        caplogic
        Icon for Helper II rankHelper II

        pcoley This is also an ideal solution. Unfortunately, I simply wouldn't know where to start to implement this. I'm a complete novice

  • Hi all,

    Thank you all for such great answers.

    I'm about to review them now, but I just wanted to say thank you before I went through the responses.

     

    Thank you