Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
GJ217
Resolver III
Resolver III

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(DateTime.LocalNow()) - [CONTINUOUS SERVICE DATE]) /12)

else

Duration.Days([TERMINATION DATE]-[CONTINUOUS SERVICE DATE])/12)

 

1 ACCEPTED SOLUTION
GJ217
Resolver III
Resolver III

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

View solution in original post

1 REPLY 1
GJ217
Resolver III
Resolver III

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.