Forum Discussion

carlochecchia's avatar
carlochecchia
Icon for Advocate I rankAdvocate I
5 years ago
Solved

Virtual Tables | Missing Employee

Hi Everyone, I have a merged dataset that combines several forms that my coworkers filled out a regarding the time they started and finished their shifts. I have set up the data refresh so it conti...
  • Jihwan_Kim's avatar
    5 years ago

     

    Who forgot to fill out the form? : =
    VAR _lastdate =
    CALCULATE ( MAX ( Data[Date] ), REMOVEFILTERS ( Data[Name] ) )
    VAR _previousworkingdate =
    CALCULATE (
    MAX ( Dates[Date] ),
    FILTER (
    Dates,
    Dates[Date] < _lastdate
    && NOT ( Dates[Day of Week] IN { 0, 6 } )
    )
    )
    VAR _employeeslastdatelist =
    CALCULATETABLE (
    VALUES ( Data[Name] ),
    FILTER ( RELATEDTABLE ( Data ), Data[Date] = _lastdate )
    )
    VAR _employeespreviousworkingdatelist =
    CALCULATETABLE (
    VALUES ( Data[Name] ),
    FILTER ( RELATEDTABLE ( Data ), Data[Date] = _previousworkingdate )
    )
    VAR _fillintheformeveryworkingday =
    INTERSECT ( _employeeslastdatelist, _employeespreviousworkingdatelist )
    RETURN
    IF (
    HASONEVALUE ( Names[Name] ),
    IF (
    COUNTROWS ( _fillintheformeveryworkingday ) = 1,
    "fill in on last date",
    "forget to fill in"
    )
    )