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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Anonymous
Not applicable

DATEADD function

Hello, I'm having an issue calculating a total. Here is what I'm trying to do. In the end I'm trying to calculate the total for the prior day. If the prior day happens to fall on Sunday, then take the day before that. I haven't even got that far. First I was trying to get accurate results for the prior day. Since today is 8/3/2020, prior day date is 8/2/2020. However, you will see in my screenshot below I'm getting odd results. I have scripted out the measures used and what I'm getting in a matrix. Can someone explain what is happening here? For both these measure I'm expecting to see 8/2/2020 in the row for the date and blank for the total since I only have 46 records back on the 31st of July. Also, how would I create my measure to account for going back an additional day if the previous day is Sunday? 

 

Untitled.png

 

Thanks in advance! 

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , You can create Rank like given in this one. Change the formula to have only Sunday as holiday

https://community.powerbi.com/t5/Community-Blog/Travelling-Across-Workdays-Decoding-Date-and-Calendar-4-5-Power/ba-p/1187766

 

To find previous day with Rank is same as finding last week using Rank

https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

v-lionel-msft_0-1596506546659.png

Please give these two sample tables and I will create the DAX formula for you.

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

parry2k
Super User
Super User

@Anonymous change your main measure to this:

 

No Response = CALCULATE ( SUM ( 'Table'[Total] ), 'Table'[Y/N] = "No Response" ) 

 

and also make sure your _calendar table is marked as a date table.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

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