Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

ALLEXCEPT not ignoring filters

Ultimately I am building a measure that looks like this:

CALCULATE(SUM(Table[Amount]), FILTER(ALLEXCEPT(Table, Table[Project]), Table[Date] <=SELECTEDVALUE(Table[Week])))


This calculates a JTD amount based on the selected [Week]. The measure functions fine for the most part, but there are certain projects that return a blank value. When digging into the actual data for these projects, they exist and do have a JTD amount that it should return. When they return a blank, I think it's because the project does not contain the SELECTEDVALUE(Table[Week]).


So, I started testing to check if it was the SELECTEDVALUE(Table[Week]) portion that was causing the blanks.

 

To test, I created a measure like this: CALCULATE(MAX(Table[Week]), ALLEXCEPT(Table, Table[Week]))
This works fine on it's own, but as soon as I add a filter for Table[Project] it returns a blank value. 

All data is coming from the same table.
[Week] and [Date] are datetime
[Project] is text
[Amount] is number


Any ideas what I'm doing wrong?



  • az38's avatar
    az38
    6 years ago

    @hahl

    Yes, exactly. wrong copy and paste 😞

    Measure = 
    var _endDate = CALCULATE(MAX('CalendarTable'[Date]))
    RETURN
    CALCULATE(SUM('Table'[Amount]),FILTER(ALLEXCEPT('Table','Table'[Project]),'Table'[Date]<= _endDate ))

    Безымянный.png

15 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks, I'm not looking for relative date filtering. I need JTD amounts where the week is the end date, so filtering by the week only wouldn't get me what I need.

      • az38's avatar
        az38
        Icon for Community Champion rankCommunity Champion

        Anonymous 

        what else filter do you need? filter by project is included in my statement

  • az38's avatar
    az38
    Icon for Community Champion rankCommunity Champion

    Anonymous 

    try

    CALCULATE(SUM(Table[Amount]), ALLEXCEPT(Table, Table[Project]), FILTER(ALL(Table), Table[Date] <=SELECTEDVALUE(Table[Week])))
    • Anonymous's avatar
      Anonymous
      Not applicable

      I tried this out, but it still returns blanks.