Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Power Query Error with Specific Date

Hi,   I'm getting an error with the below script and I can't see why its comming up. Can anyone please correct me on this?   if TERMINATION DATE = 31/12/4721 then Duration.Days(Date.From(DateTi...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Update, solved it myself as below

    if [TERMINATION DATE] = #date(4721, 12, 31) then
    
    Duration.Days(Date.From(DateTime.LocalNow()) - [CONTINUOUS SERVICE DATE]) /12
    
    else
    
    Duration.Days([TERMINATION DATE]-[CONTINUOUS SERVICE DATE])/12