Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
enedella
Frequent Visitor

Cumulative What if Parameter

I am trying to create a what if scenario and make the amounts cumulative over each year.

 

There is a slicer to choose what contract year the adjusted amount should start in and then a what-if parameter that has a slider to choose the adjusted $ amount. So for this example, the CY would be CY2 and the slider would have -$100.

 

My current formula to get the adjustment to start in the year that is selected from the slicer is:

 

 

 

Adj Amount cumulative =

 

 

 

IF(VALUES('GP Invoices SCENARIOS'[CY]) = "CY1",'$ Spend Cumulative'[$ Spend Cumulative Value],

 

IF(VALUES('GP Invoices SCENARIOS'[CY]) = "CY2",'$ Spend Cumulative'[$ Spend Cumulative Value],

 

IF(VALUES('GP Invoices SCENARIOS'[CY]) = "CY3",'$ Spend Cumulative'[$ Spend Cumulative Value],

 

IF(VALUES('GP Invoices SCENARIOS'[CY]) = "CY4",'$ Spend Cumulative'[$ Spend Cumulative Value],

 

IF(VALUES('GP Invoices SCENARIOS'[CY]) = "CY5",'$ Spend Cumulative'[$ Spend Cumulative Value],0)))))

 

 

 

This is the formula that I tried to use to make the adj amount cumulative:

 

 

 

 

 

Adj Amount Cumulative running total in Contract Year =

 

CALCULATE(

 

    [Adj Amount Cumulative],

 

    FILTER(

 

        ALLSELECTED('Dates'[Contract Year]),

 

        ISONORAFTER('Dates'[Contract Year], MAX('Dates'[Contract Year]), DESC)

 

    )

 

)

 

 

 

 

The $ Spend Cumulative comes from the slicer and has this formula:

 

 

 

$ Spend Cumulative Value = SELECTEDVALUE('$ Spend Cumulative'[Additional Amount Spent Cumulative])

 

 

 

This is what my table currently looks like:

 

 

                                                  Base spend after

              Base Spend        Adjusted Spend    Adjusted Amount

CY1         $200                   $200                                       $0

CY2        $500                    $400                                     -$100

CY3        $600                    $500                                      -$100

CY4        $800                    $700                                      -$100

Total      $2,100                 $1,800                                -$100                        

 

 

Here is what I would like the table to display.

 

                                                  Base spend after

              Base Spend        Adjusted Spend    Adjusted Amount

CY1         $200                   $200                                       $0

CY2        $500                    $400                                     -$100

CY3        $600                    $400                                      -$200

CY4        $800                    $500                                      -$300

Total      $2,100                   $1,500                                 -$600   

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @enedella ,

You can try to use following measure formula if it works for your scenario:

Measure =
VAR _select =
    SELECTEDVALUE ( 'GP Invoices SCENARIOS'[CY] )
VAR _date =
    CALCULATETABLE (
        MAX ( Dates[Date] ),
        FILTER ( ALL ( Dates ), [Contract Year] = _select )
    )
RETURN
    CALCULATE (
        SUM ( Table[Based Spend] ) - SUM ( Table[Adjusted Spend] ),
        FILTER ( ALLSELECTED ( Table ), Table[Date] <= _date )
    )

If above not help, please share some sample data for test.

Regards,
Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @enedella ,

You can try to use following measure formula if it works for your scenario:

Measure =
VAR _select =
    SELECTEDVALUE ( 'GP Invoices SCENARIOS'[CY] )
VAR _date =
    CALCULATETABLE (
        MAX ( Dates[Date] ),
        FILTER ( ALL ( Dates ), [Contract Year] = _select )
    )
RETURN
    CALCULATE (
        SUM ( Table[Based Spend] ) - SUM ( Table[Adjusted Spend] ),
        FILTER ( ALLSELECTED ( Table ), Table[Date] <= _date )
    )

If above not help, please share some sample data for test.

Regards,
Xiaoxin Sheng

Thank you, I will try this. Will you please explain the measure? @Anonymous 

Anonymous
Not applicable

Hi @enedella ,

Sure, you can take a look at following formula logic if it helps.

Logic:

1. Use selectedvalue function to get selection from slicer and stored to variable.
2. Use selected CY value to find out correspond date range, then extract max date from that range and cache to variable.
3. Do cumulative calculation on date range (less than or equal to max date which I calculated above).

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors