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
11097486
Helper I
Helper I

Previousday function: Yesterday sales not showing if no sales today

Hello. I have a DAX formula to calculate sales from the previous day: 

Sales yesterday = CALCULATE(sum([Sales]),PREVIOUSDAY([Date]))

 

The function works well, however when there is no sales for a particular day, I won't see the sales amount from the previous day (see in yellow)

Capture.PNG

 

How can I fix this?

 

Thank you

3 REPLIES 3
amitchandak
Super User
Super User

try

Sales yesterday = CALCULATE(sum([Sales]),PREVIOUSDAY([Date]))+0

Thank you for the quick response, but it only added zeros... Capture.PNG

 

 

Take Previous Day on time table

PriorDay Sales = CALCULATE(SUM(Sales[Sales_amount]),PREVIOUSDAY(Curr_Date[Sales_date]))

In my case Curr_date is marked as time table in power BI

 

Some even dates are missing

Screenshot 2019-09-14 10.28.32.png

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.