Forum Discussion
Last week sales
Hello all, please complete or correct my DAX expression for the following expression:
If today is Saturday calculate total sales between 5 days ago and 1 day ago from today.
Meanwhile, how can I do the above expression with Switch and SelectValue?
7 Replies
- Ashish_Mathur
Super User
Hi,
The general pattern is as follows:
=calculate(sum(Sales[Sales$]),datesbetween('Date'[Date],min(calendar[date])-5,min(calendar[date])-1))
- koorosh
Post Partisan
Hi Ashish, we want date between 5 days earlier today and 1 day earlier today. Why you used min expression?
- Ashish_Mathur
Super User
Because i want to capture the value of the Date. I assume that you have dragged date (from the Calendar table) to the Table visual
- koorosh
Post Partisan
Despite of what is today, I want the total minutes (or total sales for other popular sales data) for the last Monday to the next's Sunday.
Also, if I select a date by date slicer, the total for its previous Monday to next's Sunday.
- koorosh
Post Partisan
Total for the week based on the selected date by date slicer