Forum Discussion
Anonymous
6 years agoNot applicable
How to workaround Calculate function ignoring filter context
Hello, I have 2 measures. The first one simply counts all orders and the 2nd one does the same thing but for a specific date. This works fine however if I want to group the second measure by ...
- 6 years ago
Hi Anonymous
If I understand you correct try to use ALLEXCEPT() like
OrdersPrevDay = VAR PDate = LASTDATE('Calendar'[Date]) RETURN CALCULATE ( [AllOrders], ALLEXCEPT('Orders', 'Orders'[SalesAgent]), FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] > PDate - 1 && 'Calendar'[Date] <= PDate )) + 0
az38
6 years agoCommunity Champion
Hi Anonymous
If I understand you correct try to use ALLEXCEPT() like
OrdersPrevDay =
VAR PDate = LASTDATE('Calendar'[Date])
RETURN
CALCULATE ( [AllOrders],
ALLEXCEPT('Orders', 'Orders'[SalesAgent]),
FILTER ( ALL ( 'Calendar' ),
'Calendar'[Date] > PDate - 1 &&
'Calendar'[Date] <= PDate )) + 0Anonymous
6 years agoNot applicable
az38 your solution was exactly what I was looking for. Thank you very much.
I will try the other things suggested as well.