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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors