cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Super User IV
Super User IV

try

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


Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted

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

 

 

Highlighted

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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors