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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Nijlal01
Helper I
Helper I

Check if combination in table occurs in other table

Hi,

 

I would like to create a column or measure in table 2 which checks if a combination occurs in table 1. So for example product=a and customer=2 does not occur in table 1 so the result in table 2 for this combination is 'Not OK'.

 

The tables are related on product.

 

Thanks already!

 

Table1 

ProductCustomer
a1
b2
c3

Table2

ProductCustomerresult
a1OK
a2NOT OK
b2OK
c3OK
c2NOT OK
1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

@Nijlal01 , you may tweak the measure this way

Result = 
IF (
    CALCULATE (
        ISEMPTY ( 'Product Filtered GlobalID' ),
        TREATAS (
            SUMMARIZE ( ItemsMapping, ItemsMapping[Code], ItemsMapping[ID] ),
            'Product Filtered GlobalID'[Product.ProductCode],
            'Product Filtered GlobalID'[Product.ProductGlobalID]
        )
    ),
    "NOT Ok",
    "OK"
)

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

4 REPLIES 4
CNENFRNL
Community Champion
Community Champion

@Nijlal01 , not knowing the cardinality of Table1, I use two unrelated tables and the following measure,

Result = 
IF (
    CALCULATE (
        ISEMPTY ( Table1 ),
        TREATAS ( Table2, Table1[Product], Table1[Customer] )
    ),
    "NOT Ok",
    "OK"
)

Screenshot 2021-02-17 195352.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Nijlal01
Helper I
Helper I

Thanks! It almost works. In the real example however both tables do have more columns. It seems that therefore this option does not work completely. However only the 2 columns (like in the example) have to be compared. Any suggestion how to solve this? PowerBIChallenge.png

 

CNENFRNL
Community Champion
Community Champion

@Nijlal01 , you may tweak the measure this way

Result = 
IF (
    CALCULATE (
        ISEMPTY ( 'Product Filtered GlobalID' ),
        TREATAS (
            SUMMARIZE ( ItemsMapping, ItemsMapping[Code], ItemsMapping[ID] ),
            'Product Filtered GlobalID'[Product.ProductCode],
            'Product Filtered GlobalID'[Product.ProductGlobalID]
        )
    ),
    "NOT Ok",
    "OK"
)

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

harshnathani
Community Champion
Community Champion

Hi @Nijlal01 ,

 

Create a Calculated Column in Table 2.

 

 

 

Final Column = IF (Table2[Customer] = LOOKUPVALUE(Table1[Customer],Table1[Product],Table2[Product]) , "OK" , "Not Ok")

 

1.JPG

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

 

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

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!

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.

Users online (29)