Forum Discussion

shahrukhgaffar0's avatar
shahrukhgaffar0
Regular Visitor
10 months ago
Solved

Wanna Create Waterfall Visual

Hi All, I want to create a WaterFall Visual But Some Conditions i Want in it This is My Target Visual That i need to be  and Below is my Power BI visual   Condition YTD Sales wi...
  • Ilgar_Zarbali's avatar
    10 months ago

    You can force that exact order (YTD first → drivers → Variance (2nd last) → Target (last)) with a disconnected steps table and one measure that returns the amount for the currently selected step.

    • Disconnected steps table (order + types)

    Create a calculated table:

    Waterfall Steps =
    DATATABLE(
    "Step", STRING,
    "Order", INTEGER,
    "Type", STRING, -- helps with colors/“Set as total”
    {
    {"YTD Sales", 1, "Total"},
    {"Driver A", 2, "Driver"},
    {"Driver B", 3, "Driver"},
    {"Driver C", 4, "Driver"},
    {"Variance", 999,"Variance"},
    {"Target", 1000,"Total"}
    })

     

    Sort [Step] by [Order].
    (Replace Driver A/B/C with your real drivers; add/remove rows as needed.)

     

    • Base measures you already have (examples)

    [Sales YTD] := /* your YTD measure */
    [Target Value]:= /* your target measure */

    /* One driver amount measure that returns value for a single category
    in your fact table (adjust table/column names & logic) */
    [Driver Amount] :=
    VAR cat = SELECTEDVALUE ( 'Waterfall Steps'[Step] )
    RETURN
    CALCULATE ( [Base Amount],
    TREATAS ( { cat }, 'Fact'[Category] ) )

     

    • Helper: sum of ALL driver bars (ignores current point)

     

    [Sum Drivers] :=
    SUMX (
    FILTER ( ALL ( 'Waterfall Steps' ), 'Waterfall Steps'[Type] = "Driver" ),
    CALCULATE (
    [Base Amount],
    TREATAS ( { 'Waterfall Steps'[Step] }, 'Fact'[Category] )
    )
    )

     

    Base Amount should be the measure that produces each driver’s signed contribution. If your drivers come from different rules, create separate measures and sum them here instead.

     

    • Final measure used by the waterfall

     

    [Waterfall Amount] :=
    SWITCH (
    TRUE(),
    SELECTEDVALUE('Waterfall Steps'[Step]) = "YTD Sales", [Sales YTD],
    SELECTEDVALUE('Waterfall Steps'[Step]) = "Target", [Target Value],
    SELECTEDVALUE('Waterfall Steps'[Step]) = "Variance",
    [Target Value] - [Sales YTD] - [Sum Drivers],
    /* otherwise it's a driver step */
    [Driver Amount]
    )

     

    • Build the chart
    • Visual: Waterfall.
    • Category → Waterfall Steps[Step].
    • Y axis → [Waterfall Amount].
    • Click the YTD Sales bar → turn on Set as total.
    • Click the Target bar → turn on Set as total.
    • (Leave Variance as a regular bar; it will appear as the 2nd last because of the order.)
    • Optional: add a column Color to the steps table (e.g., green for YTD, red for Variance, grey for Target) and use Data colors → Conditional formatting → Field value.

    This pattern guarantees:

    • YTD Sales is always the first (total) bar,
    • your drivers appear in the middle in the exact order you defined,
    • Variance is the second-last bar computed as the gap to Target,
    • Target is the last (total) bar.

    If you share your driver logic/columns, I can plug them straight into the [Driver Amount] and [Sum Drivers] pieces for you.

     

    I hope it will help you.