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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

if statement returns true instead of date

ave this Power query that i need it to return a date value but its returning a true or false, Is there anyway to make it return a date value instead of true / false? Also how can i end the statement without the else?

if((Date.From([ACT_START_DATE]) <>"" ) and (Date.From([ACT_END_DATE]) = "") or
(Date.From([START_DATE]) <= Date.AddDays(Date.From(DateTime.LocalNow()),2))) then (Date.From([FINISH_DATE]) >= Date.AddDays(Date.From(DateTime.LocalNow()),-1)) else null)

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Basically the date i want should be FINISH_DATE that is Greater than Today Plus 1 if that makes Sense

View solution in original post

9 REPLIES 9
lukiz84
Memorable Member
Memorable Member

Yes, because you return a boolean value with this part:

 

then (Date.From([FINISH_DATE]) >= Date.AddDays(Date.From(DateTime.LocalNow()),-1))

 

What do you want to achieve?

Anonymous
Not applicable

I want to return a date

which date? your formular returns a boolean because of THIS part:

 

then (Date.From([FINISH_DATE]) >= Date.AddDays(Date.From(DateTime.LocalNow()),-1))

Anonymous
Not applicable

i want this query to return a date :

if((Date.From([ACT_START_DATE]) <>"" ) and (Date.From([ACT_END_DATE]) = "") or
(Date.From([START_DATE]) <= Date.AddDays(Date.From(DateTime.LocalNow()),2))) then (Date.From([FINISH_DATE]) >= Date.AddDays(Date.From(DateTime.LocalNow()),-1)) else null)

do you even read what i write?

 

this query will never return a date because you have >= in your "then" part. Do you want to return "FINISH_DATE" or do you want to substract something? I still don't know which date you want to return 😄

BR

Anonymous
Not applicable

Basically the date i want should be FINISH_DATE that is Greater than Today Plus 1 if that makes Sense

Anonymous
Not applicable

sorry i missed your question i apologize for that- Basically, it to return  Finish Date plus Today Plus 1  as in one day into the future

No need to apologize, I was just wondering 🙂

 

But I still don't really get it. Could you add some sample date?

 

E.g. FINISH_DATE='2022-09-30' - what do you want to return?

 

Or do you want to return some date (then which date) if FINISH_DATE is greater than today+1?

 

Anonymous
Not applicable

Basically the date i want should be FINISH_DATE that is Greater than Today Plus 1 if that makes Sense

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.