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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
mrbuttons07
Helper II
Helper II

DAX: Return Result if Value in Column A matches Value in Column B

Hello everyone,

I want to return result if value from Column A matches with Value from Column B but with conditions. For example,

IF Date Comparison, FAILED & Qty Comparison, PASS THEN 0
IF Date Comparison, PASS & Qty Comparison, FAILED THEN 0
IF Date Comparison, PASS & Qty Comparison, PASS THEN 1

mrbuttons07_0-1684915184381.png
Thanks!

 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

pls try this

 

 

Column = IF( [Date Comparison]= "FAILED" && [Qty Comparison]= "PASS" , 0,
IF ([Date Comparison] = "PASS" && [Qty Comparison]= "FAILED",  0,
IF ([Date Comparison]= "PASS" && [Qty Comparison]= "PASS", 1)))

-----or -----
Column = SWITCH(TRUE(),
[Date Comparison]= "FAILED" && [Qty Comparison]= "PASS" , 0,
[Date Comparison] = "PASS" && [Qty Comparison]= "FAILED",  0,
[Date Comparison]= "PASS" && [Qty Comparison]= "PASS", 1)

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

This should work. The 9999 is for error handling:

 

Outcome =
IF(
    AND('Table'[Date Comparison]="FAILED", 'Table'[Qty Comparison]="PASS"),
    0,
    IF(
        AND('Table'[Date Comparison]="PASS", 'Table'[Qty Comparison]="FAILED"),
        0,
        IF(
            AND('Table'[Date Comparison]="PASS", 'Table'[Qty Comparison]="PASS"),
            1,
            9999
        )
    )
)
 
ThePBIMaster_0-1684916205483.png

 

Ahmedx
Super User
Super User

pls try this

 

 

Column = IF( [Date Comparison]= "FAILED" && [Qty Comparison]= "PASS" , 0,
IF ([Date Comparison] = "PASS" && [Qty Comparison]= "FAILED",  0,
IF ([Date Comparison]= "PASS" && [Qty Comparison]= "PASS", 1)))

-----or -----
Column = SWITCH(TRUE(),
[Date Comparison]= "FAILED" && [Qty Comparison]= "PASS" , 0,
[Date Comparison] = "PASS" && [Qty Comparison]= "FAILED",  0,
[Date Comparison]= "PASS" && [Qty Comparison]= "PASS", 1)

 

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.