Forum Discussion

kbol's avatar
kbol
Helper I
6 years ago
Solved

ALLEXCEPT Behavior - Appears To Retain Some Filters

Hi, I've got a table of timesheet entries, each with an entry date, amount of hours, and several fields I want to slice on such as the type of time. I'm trying to write a measure that compares the...
  • kbol's avatar
    kbol
    6 years ago

    I did arrive at a solution. I don't know if this is the most idiomatic approach, but should anyone else stumble upon this thread later, here's what worked for me:

     

    Time Pct = 
    VAR
        DateStart = FIRSTDATE(DateCal[Date])
    VAR
        DateEnd = LASTDATE(DateCal[Date])
    VAR
        TotalTime = CALCULATE(
            [All Time],
            ALL(Timesheet),
            Timesheet[EntryDate] >= DateStart,
            Timesheet[EntryDate] <= DateEnd
        )
    RETURN
    
    DIVIDE(
        [All Time],
        TotalTime
    )

    Note that I'm now slicing on a general Date calendar that has a relationship to Timesheet on entry date.