Forum Discussion
DAX CALCULATE with conditional DATEADD
Good Day.
I currently have two working measusres. The first shows total sales, and the second shows the total sales from the previous day:
- Anonymous5 years ago
I ended up resolving the problem. Instead of keeping a running tabular total, I directly targeted the KPI.
Using, variables, I was able to pull off what I needed:
MPreviousWeekDaySales =
VAR ThreeDaysRange = FILTER(AllDates,AllDates[Date] = TODAY() - 3)
VAR OneDayRange = FILTER(AllDates,AllDates[Date] = TODAY() - 1)
RETURN IF(WEEKDAY(TODAY()) = 2,SUMX(ThreeDaysRange,[MTotalSales]),SUMX(OneDayRange,[MTotalSales]))
1 Reply
- AnonymousNot applicable
I ended up resolving the problem. Instead of keeping a running tabular total, I directly targeted the KPI.
Using, variables, I was able to pull off what I needed:
MPreviousWeekDaySales =
VAR ThreeDaysRange = FILTER(AllDates,AllDates[Date] = TODAY() - 3)
VAR OneDayRange = FILTER(AllDates,AllDates[Date] = TODAY() - 1)
RETURN IF(WEEKDAY(TODAY()) = 2,SUMX(ThreeDaysRange,[MTotalSales]),SUMX(OneDayRange,[MTotalSales]))