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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
inawab
Frequent Visitor

Adding date to date with conditional

Hi Everyone

 

I want to add days to Date with condition if Value in column Shift = Night, but it gave error under Date.AddDays

 

IF [Shift] = "Night" then (Date.AddDays ([Date],1)) elce [Date]

 

inawab_0-1657802667311.png

 

Can someone Advice me what is wrong??

 

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @inawab ,

 

Here my result:

tomfox_0-1657803173319.png

 

 

And here the code I used:

tomfox_1-1657803195774.png

 

if [Shift] = "night" then Date.AddDays([Date], 1) else [Date]

 

Hope this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

3 REPLIES 3
KT_Bsmart2gethe
Impactful Individual
Impactful Individual

Hi @inawab ,

 

You have elce instead of else in the formula

 

Regards

KT

tackytechtom
Super User
Super User

Hi @inawab ,

 

Here my result:

tomfox_0-1657803173319.png

 

 

And here the code I used:

tomfox_1-1657803195774.png

 

if [Shift] = "night" then Date.AddDays([Date], 1) else [Date]

 

Hope this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Greg_Deckler
Super User
Super User

@inawab Power Query is picky in its syntax, upper/lower case, spaces, etc. Try this:

if [Shift] = "Night" then Date.AddDays([Date],1) else [Date]

 

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors