Forum Discussion
mimi
7 years agoAdvocate I
max as a filter
Hi I am trying to calculate sales based on the maximum invoice period, in case someone chooses multiple periods. here is my formula and it is not working. Any help will be appreciated. Sales...
- Anonymous7 years ago
Without going into whether there are any other issues with this approach, to get around the problem you have raised you'd just need to put it into a variable:
Sales = var filterDate = max(Query1[InvoicePeriod]) RETURN CALCULATE( sum(Query1[SalesValue]); Query1[InvoicePeriod] = filterDate )You'll also need to specify what the filter condition is. I've assumed you want records based on that date. However you could use <= if you wanted to get all records on or before.
- Anonymous7 years ago
I'd suggest creating a date table and having the slicer be based on that date table. Then, for variable filterdate, do the max on the DateTime instead.
Anonymous
7 years agoNot applicable
I'd suggest creating a date table and having the slicer be based on that date table. Then, for variable filterdate, do the max on the DateTime instead.
mimi
7 years agoAdvocate I
Yes it worked thank you