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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Dawn85
Frequent Visitor

Help with DAX IF AND expression OR a COUNTIF Measure

I am new to power BI so I am trying to figure out the best way to achieve the following:

What I would like is a measure (a count) of which items are late being Quoted.

I have 2 date columns; Date Received and Date Quoted.


1st idea:

I created a column with the following DAX expression:

Code:
LATE/ON TIME = IF(AND('winnipeg erp_workorder'[Date Received]<(TODAY()-5),ISBLANK('winnipeg erp_workorder'[Date Quoted]),"LATE","ON TIME")))


that I was hoping would flag which items were late and which were on time, but it was clearly written incorrectly.

What I wanted was:

If the date received was greater than 5 days prior to todays date AND Date Quoted is blank, mark as "LATE", otherwise it is "ON TIME".

I then want to create a measure that counts anything that is listed as "LATE".

2nd idea:

Perhaps the count could be done without creating the extra column and do a measure that counts the row If the date received was greater than 5 days prior to todays date AND Date Quoted is blank.

I hope someone can help me, still trying to learn DAX.

Thank you

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

You've got some mismatched parentheses.

 

Does it work as expected when you fix that?

LATE/ON TIME =
IF (
    AND (
        'winnipeg erp_workorder'[Date Received]
            < ( TODAY () - 5 ),
        ISBLANK ( 'winnipeg erp_workorder'[Date Quoted] )
    ),
    "LATE",
    "ON TIME"
)

View solution in original post

2 REPLIES 2
Dawn85
Frequent Visitor

Perfect! I was definitely over complicating it. Thank you very much!!

AlexisOlson
Super User
Super User

You've got some mismatched parentheses.

 

Does it work as expected when you fix that?

LATE/ON TIME =
IF (
    AND (
        'winnipeg erp_workorder'[Date Received]
            < ( TODAY () - 5 ),
        ISBLANK ( 'winnipeg erp_workorder'[Date Quoted] )
    ),
    "LATE",
    "ON TIME"
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors