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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Community Champion
Community Champion

@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]

 

 



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.