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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Rody
Frequent Visitor

DAX if formula with multiple conditions

Hi there,

I have searched the forum and tried multiple suggestions but I have not managed to work it out. What I like to do is add a new column, that shows a 1 if the condition is met otherwise 0. I am using the formula below but shows all items as 0. If I filter manually on the columns than  multiple records show up. Does anyone has an idea how to do this better? Thanks in advance.

 
Lagging - Survey items overdue = IF(
    'Cority_Corrective_Actions_M_001 SiC'[Reference Type] = "Safety Inspection/Survey"
    && 'Cority_Corrective_Actions_M_001 SiC'[Status] = "Action - In Progress"
    && 'Cority_Corrective_Actions_M_001 SiC'[Status] = "Action - Ready for Review"
    && 'Cority_Corrective_Actions_M_001 SiC'[Observation Status] = "Overdue",
    1,
    0
)
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please try the below.

I think, the reason why the result only shows zero is because of the column, 'Cority_Corrective_Actions_M_001 SiC'[Status] = "Action - In Progress" and "Action - Ready for Review"

I am not sure, but I think the [Status] column in one row cannot have two result at the same time.

 

Lagging - Survey items overdue =
IF (
    'Cority_Corrective_Actions_M_001 SiC'[Reference Type] = "Safety Inspection/Survey"
        && OR (
            'Cority_Corrective_Actions_M_001 SiC'[Status] = "Action - In Progress",
            'Cority_Corrective_Actions_M_001 SiC'[Status] = "Action - Ready for Review"
        )
        && 'Cority_Corrective_Actions_M_001 SiC'[Observation Status] = "Overdue",
    1,
    0
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

3 REPLIES 3
MahyarTF
Memorable Member
Memorable Member

Hi,

As you used "&&"in your Dax for the Status column in 2 different values, the result of the If function should go to Else (0).

If you want to check if the Status is "Action - In Progress" or "Action - Ready for Review", you need to put "||" or OR() in your dax formula

Mahyartf
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please try the below.

I think, the reason why the result only shows zero is because of the column, 'Cority_Corrective_Actions_M_001 SiC'[Status] = "Action - In Progress" and "Action - Ready for Review"

I am not sure, but I think the [Status] column in one row cannot have two result at the same time.

 

Lagging - Survey items overdue =
IF (
    'Cority_Corrective_Actions_M_001 SiC'[Reference Type] = "Safety Inspection/Survey"
        && OR (
            'Cority_Corrective_Actions_M_001 SiC'[Status] = "Action - In Progress",
            'Cority_Corrective_Actions_M_001 SiC'[Status] = "Action - Ready for Review"
        )
        && 'Cority_Corrective_Actions_M_001 SiC'[Observation Status] = "Overdue",
    1,
    0
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Amazing, that sorted it! I get your point now about two variables in the same column. Thanks heaps, that took me all morning.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.