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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

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
Most Valuable Professional
Most Valuable Professional

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
Most Valuable Professional
Most Valuable Professional

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
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.