Forum Discussion
Anonymous
5 years agoNot applicable
Cumulative total for previous day
Cumulative total for previous day. I want a measure that calculates the total amount for previous day based on the last or max date based on a slicer. My code works for the max date but not when ...
- 5 years ago
Hello FredL
Try :
Inv Amt PD = // list of dates in a day before var _allDates = DATEADD('Date'[Date],-1,DAY) // to see LAST date of day before var _lastDate = LASTDATE(_allDates) return CALCULATE ( '1 Invoice Table'[Invoice Amount], 'Date'[Column]=_lastDate)Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Best Regards
BC
AllisonKennedy
Community Champion
5 years agoAnonymous DATEADD is time intelligence so returns all Days selected but shifted 1 day prior.
If you just want to look at the MAX day, you need to use MAX(Date[Date])-1 or put your Inv Amt PD into a visual by Date.
For the single day measure:
Single Day Inv Amt PD =
_Date = MAX(Date[Date])-1
CALCULATE ( [Invoice Amount], FILTER(Date, Date[Date] = _Date )