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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
garimajain85
Frequent Visitor

If Statement with Dates

Trying to add a column with If then statement:

if [DOH]>= Date.IsInPreviousNDays([HR Data Received Date],180 )
then"Active"else"Inactive"

 

and reciving following error message:

Expression.Error: We cannot apply operator < to types Logical and Date.
Details:
Operator=<
Left=FALSE
Right=2/15/2021

 

1 ACCEPTED SOLUTION
ManuelBolz
Super User
Super User

Hello @garimajain85,

the result from Date.IsInPreviousNDays([HR Data Received Date],180 ) is TRUE or FALSE.
Next you try to calculate if [DOH] >= TRUE/FALSE then [...]

I thing you want this
if [DOH] >= Date.AddDays([HR Data Received Date], 180)
then "Active"
else "Inactive")

View solution in original post

3 REPLIES 3
DLynn91
New Member

Hello,

 

I am wanting to make a custom column that tells me if a customer order date exceeds a certain # of days past production end. I.E If Column X >=7+ days of column y, return "contact ae" or if false "in window". Here is what i tried and no luck. Any ideas how to write this out in DAX? 

 

Column = IF('Sort Report'[CDD].[Date]='Sort Report'[EPED].[Date]>7,"Contact AE","In Window")
 
Any help is appreciated 🙂
ManuelBolz
Super User
Super User

Hello @garimajain85,

the result from Date.IsInPreviousNDays([HR Data Received Date],180 ) is TRUE or FALSE.
Next you try to calculate if [DOH] >= TRUE/FALSE then [...]

I thing you want this
if [DOH] >= Date.AddDays([HR Data Received Date], 180)
then "Active"
else "Inactive")

AlienSx
Super User
Super User

lg.jpg

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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