Forum Discussion
Calculating data for the day before the selected plus additional filter
- Anonymous6 years ago
thanks a lot! it seems I finally found a solution. now I'm calculating value for the day BEFORE THE SELECTED like that:
var mydate=SELECTEDVALUE(DateTimeTable[date])returnCALCULATE(SUM(Data[AmountUSD]), ALL(DateTimeTable), 'Data'[type]=0, 'Data'[date]=mydate-1)I have no idea what was wrong with the first attempt, also second attempt and n-th attempt, but this one works perfectly.
You have mentioned
"2) DateTimeTable
Actually, date timetable with one column Date with distinct values for dates
"
Make sure your date timetable is continuous table else use power BI calendar command to generate the calendar.
Try to take a max of the selected value. This should even work without selected value.
Var _end_date=(maxx('Date','Date'[Date]))
Use this in =.
Also, test the data without date filter check that another filter is working fine.
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
amitchandak , got it, sorry. so I've tried MAX function, same blank value
- amitchandak6 years ago
Super User
Is it possible to share sample pix after removing sensitive information?
- Anonymous6 years agoNot applicable
thanks a lot! it seems I finally found a solution. now I'm calculating value for the day BEFORE THE SELECTED like that:
var mydate=SELECTEDVALUE(DateTimeTable[date])returnCALCULATE(SUM(Data[AmountUSD]), ALL(DateTimeTable), 'Data'[type]=0, 'Data'[date]=mydate-1)I have no idea what was wrong with the first attempt, also second attempt and n-th attempt, but this one works perfectly.- v-chuncz-msft6 years ago
Community Support
Anonymous
By the way, you may help accept solution. Your contribution is highly appreciated.
https://www.sqlbi.com/articles/filter-arguments-in-calculate/