Forum Discussion
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?
Thanks in advance!
3 Replies
- parry2kSuper 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.⚡
- v-lionel-msftCommunity Support
Hi Anonymous ,
Please give these two sample tables and I will create the DAX formula for you.
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- amitchandakSuper User
Anonymous , You can create Rank like given in this one. Change the formula to have only Sunday as holiday
To find previous day with Rank is same as finding last week using Rank