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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.