Forum Discussion

bron12321's avatar
bron12321
Frequent Visitor
3 years ago
Solved

Return Date based on Conditions from same table

Hi, i've been trying to follow this: Solved: Date difference between values in same column - Microsoft Fabric Community Since I want to get a similar result. I need to calculate the difference in da...
  • bron12321's avatar
    3 years ago

    After going away and coming back to it I've decided a new approach which I think works better:

    Late2 =
    VAR varCurrentScenarioID = Master[UniqueID]
    VAR varCurrentEntryType = Master[EntryType]
    VAR varCurrentDate = Master[Date]
    VAR DateDifference =
    IF(
        varCurrentEntryType = "ForecastDate",
        DATEDIFF(varCurrentDate,
            LOOKUPVALUE(Master[Date],Master[UniqueID],varCurrentScenarioID,Master[EntryType],"BaselineDate"),
            DAY),
        blank()
        )
    VAR Result =  
    IF(DateDifference < 0, "Late",BLANK())
    RETURN
        Result