Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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 ...
  • az38's avatar
    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