Forum Discussion

aggiemullins's avatar
aggiemullins
Frequent Visitor
6 years ago
Solved

Help with creating a 24 hour Work Shift date table

I'm a DAX noob trying to create a calculated Work Shift date table to return a work shift letter based on date and time.   We have 4 shifts (A, B, C, D) and they run for 24 hours per shift, 7 days ...
  • HotChilli's avatar
    HotChilli
    6 years ago

    It'll be something like this:

    ColumnK = VAR _date = TableTxn[date]
    RETURN
        CALCULATE(MAX(TableShift[shift]), FILTER(TableShift, _date >= TableShift[start] && TableShift[end] > _date ))

     Please adapt and test as required.