Forum Discussion

coochy5's avatar
coochy5
Icon for Helper II rankHelper II
1 year ago
Solved

Need to create a shift (days off) calendar in matrix visualisation - overlaid with vacations

Hi there, Hoping for some assistance, as I've come completely unstuck with this, and not even sure if best handled within Power Query, or in DAX. Why I don't know which it should be - trying to map...
  • jgeddes's avatar
    jgeddes
    1 year ago

    If you change the isOff measure to...

    isOff = 
    var _employee = 
    SELECTEDVALUE(vacationTable[Name])
    var _shiftEffectDate = 
    MINX(shift_table, shift_table[EffectiveDate])
    var _modValue = 
    MINX(shift_table, shift_table[DaysOn]) + MINX(shift_table, shift_table[DaysOff])
    var _comparisonValue = 
    MINX(shift_table, shift_table[DaysOn])
    var _testValue =
    Value(SELECTEDVALUE(dimDate[Date]) - _shiftEffectDate)
    var _mod =
    MOD(_testValue, _modValue)
    var _shiftName = 
    "#FFB6C1"//MINX(shift_table, shift_table[Name])
    var _testDate = 
    SELECTEDVALUE(dimDate[Date])
    var _offCount = 
    COUNTROWS(FILTER(vacationTable, vacationTable[Name] = _employee && vacationTable[Date] = _testDate))
    Return
    IF(
        _testValue >= 0,
        IF(_mod>=_comparisonValue,_shiftName,IF(_offCount>0,"#fed70d" ,"")),
        ""
    )

    You will end up with...