Forum Discussion

sahooak's avatar
sahooak
Frequent Visitor
10 months ago
Solved

How create a stacked bar chart 100% completion Line?

Hello Everyone,

I need help with this chart. We're currently migrating from Tableau to Power BI. I've to recreated a chart in Power BI that we originally built in Tableau.

In the bar chart, I'm showing shipment values, with status represented in the legend. On the right side, I'm displaying the forecasted shipment values for each category.

There's also a dotted line in the chart, which represents a constant 100% target line. As the actual shipment value for a category approaches its forecasted value, the corresponding bar moves closer to the dotted line, visually indicating the percentage of completion.

My question is:
Is there a way to replicate this behavior in Power BI, where the bars dynamically reflect how close the actual shipment values are to their forecasted targets, ideally by reaching toward the dotted line?

achecive this


Best Regards,
Ak

 

10 Replies

  • Hi sahooak ,
    You can follow these steps to get the desired result for your chart 
    but make sure you have fields like: Category, Actual Shipment, Forecast Shipment

    1. Create Measures

    DAX 
    % Achieved = DIVIDE([Actual Shipment], [Forecast Shipment], 0)

    This gives you the ratio between actual and forecast.

    2. Create a Bar Chart

    Use a Clustered Bar Chart (horizontal).

    X-axis: % Achieved

    Y-axis: Category

    3.Add a Constant Line

    Go to Analytics Pane → Constant Line → Value = 1 (or 100%)

    Style it as dotted or dashed

    Label it “Target (100%)”

    4. Format

    Set X-axis to show percentage values (0–1 or 0–100%).

    Color the bars based on Status (using the Legend).

    Adjust transparency or data labels as needed.

    Hope this solution helps you make the most of Power BI! If it did, click 'Mark as Solution' to help others find the right answers.
    💡Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!
    🚀Let’s keep building smarter, data-driven solutions together!🚀 [Explore More]



      • GrowthNatives's avatar
        GrowthNatives
        Super User

        Yes sahooak 
        We’ll combine:
        • Bar chart for Actual % Achieved
        • Line (or marker) for Forecast
        • Constant dotted line at 100%

        Create core measures 

        DAX 
        % Achieved = 
        DIVIDE([Actual Shipment], [Forecast Shipment], 0)
        
        Forecast % = 1   // represents the target 100% line logically


        If you want to display Forecast shipment values as an actual bar (beyond 100%), also create:

        DAX 
        Forecast Shipment % =
        DIVIDE([Forecast Shipment], [Forecast Shipment], 0)   // always 1, but used for scaling alignment


        or, if you want to show absolute forecast values on a secondary axis:

        DAX
        Forecast Value = [Forecast Shipment]


        Hope this solution helps you make the most of Power BI! If it did, click 'Mark as Solution' to help others find the right answers.
        💡Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!
        🚀Let’s keep building smarter, data-driven solutions together!🚀[Explore More]




    • MattiaFratello's avatar
      MattiaFratello
      Super User

      If yes, please see the steps below:

       

      % = sum('Table'[Actual])/sum('Table'[Target])

       

       

       

       

       

       

      And then create the multi card on the right

       

       

       

      If it helped, please accept it as a solution

       

  • v-tejrama's avatar
    v-tejrama
    Community Support

    Hi sahooak ,

     

    Thanks for sharing the details and the screenshot. I tried to recreate the setup using a sample dataset with the same field structure, and the visual appears to behave as expected. The combination of a stacked column and a line chart works correctly when using one measure on the column axis Sum of ShipmentValue and multiple measures on the line axis Target 100% and Shipment %, with Category on the shared axis and Status on the legend.

     

    If you’re seeing a mismatch, missing line, or label overlap, it might be due to how the data types or aggregation levels are set up. It’s worth checking that both Target 100% and Shipment % are formatted consistently as decimal or percentage values and that the secondary axis is properly scaled. You could also try removing and re-adding one of the measures to refresh the visual binding, as Power BI occasionally holds onto an old field reference when visuals are edited multiple times.

     

    If the issue still persists after confirming those settings, please share a brief description of the behavior you’re seeing for example, whether the line disappears, the scale is incorrect, or data labels overlap. That will help determine whether this is a reproducible product issue or something related to the underlying data model.

    This is the answer I am providing. Can you please validate if this workaround is working properly for you? Let me know if you have any other queries

    Please find the attached PBIX and Screenshort file for your reference.

     

     

    Best Regards,
    Tejaswi.
    Community Support