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! Learn more

Reply
Anonymous
Not applicable

Compare a function with a date. Help me please. (DAX)

Can someone help me? I inserted the following function:

 

if [Status] = "in progress" and [Actual End] = null and [Scheduled End]> = Date.IsInCurrentDay then "3" else
if [Real Start] = null and [Programmed End]> = Date.IsInCurrentDay then "1" else
if [Actual End] <= Date.IsInCurrentDay and [Actual End] <= [Scheduled End] and [Actual End] <> null then "1" else "2"

 

I get the following message: Expression.Error: We were unable to apply the <operator to the Function and Date types.
Details:
     Operator = <
     Left = [Function]
     Right = 08/29/2019

Can someone help me?

 

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

Maybe it is just how you posted it bu there were spaces between some of the >= so I removed those below. Hard to test though.

 

if [Status] = "in progress" and [Actual End] = null and [Scheduled End] >= Date.IsInCurrentDay then "3" else
if [Real Start] = null and [Programmed End] >= Date.IsInCurrentDay then "1" else
if [Actual End] <= Date.IsInCurrentDay and [Actual End] <= [Scheduled End] and [Actual End] <> null then "1" else "2"



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...
Anonymous
Not applicable

Greg, first of all thank you for your interest in helping, but it has nothing to do with space. "No syntax errors detected". The "x" of the question here is how to compare a column with dates to a function. In the example case I am trying to use the "Date.IsInCurrentDay" function.

Anonymous
Not applicable

To make it clearer, I want to compare a column with dates and a function with a current date to find out if this condition sets a status to "Expired", for example.

Anonymous
Not applicable

Well, the syntax for the function is:

Date.IsInCurrentDay(dateTime as any) as nullable logical

What you're trying to do is use the function without arguments, which is akin to referring to the function and not its results.

What you probably need is a comparison with:

DateTime.FixedLocalNow()

Best
D

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.