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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Junaid11
Helper V
Helper V

Subtract the column from a fixed value

Hello,
I have a below table:

DateEpenditureBudget
1/1/202323549800
1/2/202334 
1/3/20236786 
1/4/2023345 
1/5/202357 
1/6/202335 
1/7/202334 
1/8/202367 
1/9/202357 
1/10/202367 

I want to subtract expenditure from budget based on date starting from ascendingly and want to see how much budget is remaining.
My outcome will look like below:

DateEpenditureBudgetOutcome
1/1/2023235498007446
1/2/202334 7412
1/3/20236786 626
1/4/2023345 281
1/5/202357 224
1/6/202335 189
1/7/202334 155
1/8/202367 88
1/9/202357 31
1/10/202367 -36

YOUR HELP WOULD BE HIGHLY APPRECIATED.
THANK YOU

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Junaid11 ,

 

Here is a measure that produces the precise table that you displayed in your question.

Outcome = 
VAR currentDate = 
SELECTEDVALUE('Table'[Date])
RETURN
    IF(
        HASONEVALUE('Table'[Date]),
        9800
           - CALCULATE(
                SUM('Table'[Ependiture]),
                'Table'[Date] <= currentDate,
                ALLEXCEPT('Table','Table'[Date])
            )
        ,9800 - sum('Table'[Ependiture])
    )

 

 The outcome is showed in the below picture.

8.png

There is a similar question which was answered by Chris Mendoza. Thanks for his contribution!
You can look it up through this link: Solved: Subtract the value by fixed value to get next subt... - Microsoft Fabric Community

 

Additional Tips:

In the future, if you have a various range of budgets, you may consider using the following step.

 

Go to Modeling ---- New Parameters ---- Numeric Range, and enter a range of numbers you would like to use as budget.


And then change the measure to a new version:

Outcome = 
VAR currentDate = 
SELECTEDVALUE('Table'[Date])
VAR budget =
SELECTEDVALUE('Table'[Budget])
RETURN
    IF(
        HASONEVALUE('Table'[Date]),
        [Parameter Value]
           - CALCULATE(
                SUM('Table'[Ependiture]),
                'Table'[Date] <= currentDate,
                ALLEXCEPT('Table','Table'[Date])
            )
        ,[Parameter Value] - sum('Table'[Ependiture])
    )

 

 

Now the table will change if the parameter value changes.

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Junaid11 ,

 

Here is a measure that produces the precise table that you displayed in your question.

Outcome = 
VAR currentDate = 
SELECTEDVALUE('Table'[Date])
RETURN
    IF(
        HASONEVALUE('Table'[Date]),
        9800
           - CALCULATE(
                SUM('Table'[Ependiture]),
                'Table'[Date] <= currentDate,
                ALLEXCEPT('Table','Table'[Date])
            )
        ,9800 - sum('Table'[Ependiture])
    )

 

 The outcome is showed in the below picture.

8.png

There is a similar question which was answered by Chris Mendoza. Thanks for his contribution!
You can look it up through this link: Solved: Subtract the value by fixed value to get next subt... - Microsoft Fabric Community

 

Additional Tips:

In the future, if you have a various range of budgets, you may consider using the following step.

 

Go to Modeling ---- New Parameters ---- Numeric Range, and enter a range of numbers you would like to use as budget.


And then change the measure to a new version:

Outcome = 
VAR currentDate = 
SELECTEDVALUE('Table'[Date])
VAR budget =
SELECTEDVALUE('Table'[Budget])
RETURN
    IF(
        HASONEVALUE('Table'[Date]),
        [Parameter Value]
           - CALCULATE(
                SUM('Table'[Ependiture]),
                'Table'[Date] <= currentDate,
                ALLEXCEPT('Table','Table'[Date])
            )
        ,[Parameter Value] - sum('Table'[Ependiture])
    )

 

 

Now the table will change if the parameter value changes.

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

amitchandak
Super User
Super User

@Junaid11 , with the help date table, create measures like

 

MTD Sales = CALCULATE(SUM(Table[Budget]) - SUM(Table[Ependiture]) ,DATESMTD('Date'[Date]))

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors