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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
amirel01
Frequent Visitor

Running Balance and Adding Previous Month Balance

amirel01_0-1698344588513.png

I have calculated my running balance: if balance between available and scheduled is less than 0, than 0 otherwise the difference of available to scheduled - we can't carry over a positve balance. If you don't use it you lose it. My problem is that I then need adjusted scheduled hours to be scheduled hours + -running balance from previous month. You can see in my formula I used CALCULATE('Scheduled Hours Report'[Running Balance],PREVIOUSMONTH('Date'[Date])) but it's not pulling my running balance from the previous month. Is this because my running balance is from two different tables linked by date? If so, how do I get an adjusted scheduled hours column based on any negative difference between available and scheduled hours.

1 ACCEPTED SOLUTION

it seams PREVIOUSMONTH filters the date range, and ALLSELECTED can not remove that filter

try to change ALLSELECTED to ALL 

View solution in original post

4 REPLIES 4
amirel01
Frequent Visitor

Thanks for your help. Below is the other formula's. Let me know if there is anything else I can provide to get more help on solving this 🙂

Running Balance =
IF([Running Total Available Hours]-[Running Total Scheduled Hours]>0,0,[Running Total Available Hours]-[Running Total Scheduled Hours])

Running Total Available Hours =
CALCULATE(
    SUM('Available Hours'[Available Hours]),
    FILTER(
        ALLSELECTED('Date'[Date]),
        ISONORAFTER('Date'[Date], MAX('Date'[Date]), DESC)
    )
)



Running Total Scheduled Hours =
CALCULATE(
    [Scheduled Hours],
    FILTER(
        ALLSELECTED('Date'[Date]),
        ISONORAFTER('Date'[Date], MAX('Date'[Date]), DESC)
    )
)

it seams PREVIOUSMONTH filters the date range, and ALLSELECTED can not remove that filter

try to change ALLSELECTED to ALL 

That worked. Thank you so much!

wdx223_Daniel
Super User
Super User

can you show the code of other three measures?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.