Forum Discussion

rheims's avatar
rheims
Frequent Visitor
5 years ago
Solved

Stacked Bar chart with Dynamic Target

I have a visualization I created in Tableau that I want to recreate in PowerBI.

It is a stacked bar chart with a dynamic target for a budget.  I can't figure out how to create this with full horizontal line across the column for the target. 

I have attached the example I am trying to duplicate from tableau.

The best I can get is like this.... The data sets are not the same but you get the idea.

I would really like the red target line to be horizontal lines like the tableau version above.

Any ideas?

  • Hi rheims ,

     

    What you can do is to change the way the line setup is you can do the following:

    • Reduce the size of the line to zero
    • Turn on the Marker
    • Change the marker to line
    • Make the marker as big as you can

    Final result below

     

3 Replies

  • Hi rheims 

    Download this PBIX file with sample data and visual.

    You can create a measure to be used as your target.  For this example I've just used this

    Measure = (SUM('Table'[AAT])+SUM('Table'[NC])+SUM('Table'[Supp])+SUM('Table'[Travel])) * 0.85

    Add the measure as the line value.

    Turn on Data Labels, turn off Show Background and turn on Customize series

    Set the line color to something that stands out (excuse the colors below, they're not easy on the eye)

    Under Shapes set the Stroke width to 0 and you don't need markers

    You should have something like this

     

    Now click on the Measure and in the Format area of the Ribbon type over the current format with this

    ■■■■■■■■■■;

    and hit Enter.  Note the ; at the end of that string

    The numbers/labels for the measure will now be the characters you just typed in

     

    What this is doing is using a Custom Format string to format positive values.  I'm using the character ALT+254 which is ■ but you can use any symbol you like.

    Further info https://www.myonlinetraininghub.com/custom-formatting-strings-in-power-bi 

    Regards

    Phil

     

    • rheims's avatar
      rheims
      Frequent Visitor

      When I try this I can get the line to show up but the marker does not go away. Also the lines shows higher that it should on the left hand axis. so it is off as the label is place above the actual mark where it should be.

       

  • Hi rheims ,

     

    What you can do is to change the way the line setup is you can do the following:

    • Reduce the size of the line to zero
    • Turn on the Marker
    • Change the marker to line
    • Make the marker as big as you can

    Final result below