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! Request now

Reply
roman_gorbunov
Frequent Visitor

Сalculate value on previous day inside dynamic formula

Hello, I have an indicator that calculates the current balance of goods by calculating the difference between the accumulated totals of the purchased quantity and the quantity sold.

 

Current balance of goods =

CALCULATE(
[purchased in period)],
FILTER(
ALLSELECTED('Calendar'[Date]),
ISONORAFTER('Calendar'[Date], MAX('Calendar'[Date]), DESC)
)
)
-
CALCULATE(
[sold in period],
FILTER(
ALLSELECTED('Calendar'[Date]),
ISONORAFTER('Calendar'[Date], MAX('Calendar'[Date]), DESC)
)
)

 

Now I need to get the value of the remainder of goods for the previous day.

It's easy to do it with a physical table, but I can't do it with a DAX. I tried to do it in various ways using DATEADD('Calendar'[Date], -1, DAY) but it didn’t work (either it’s not correct, or I get an error).

 

Is there a way to do this with the formula ? 

Thanks in advance for any help.

 
2 REPLIES 2
AlexisOlson
Super User
Super User

Does changing ISONORAFTER to ISAFTER work?

roman_gorbunov
Frequent Visitor

I have found a solution - it is very simple :

MAX('Calendar'[Date])-1

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.