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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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