Forum Discussion
Measure with multiple filters on same field
- 3 years ago
FILTER can handle multiple conditions as long as they are on the same table, you just need to join them with && for and and || for or conditions.
If you are using them inside a CALCULATE statement then you don't need to explicitly specify FILTER, you can pass in as many filter conditions as you like and they can be across multiple tables.
For the relative date filter, if you have a proper date table set up you could use something like
Within last 3 months = VAR StartDate = EOMONTH ( TODAY (), -4 ) + 1 RETURN CALCULATE ( [My measure], DATESBETWEEN ( 'Date'[Date], StartDate, TODAY () ) )
Perfect, that works! Thanks a lot for the fast response! 🙂
Would you have some advice on the other questions I added later, too? ->
FILTER can handle multiple conditions as long as they are on the same table, you just need to join them with && for and and || for or conditions.
If you are using them inside a CALCULATE statement then you don't need to explicitly specify FILTER, you can pass in as many filter conditions as you like and they can be across multiple tables.
For the relative date filter, if you have a proper date table set up you could use something like
Within last 3 months =
VAR StartDate =
EOMONTH ( TODAY (), -4 ) + 1
RETURN
CALCULATE ( [My measure], DATESBETWEEN ( 'Date'[Date], StartDate, TODAY () ) )