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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Comparing two tables and returning mismatched names

Hi all,

 

I have two tables, one is the parent table containing all company names, other is a subset with a fewer company names.

 

I want to create a measure to return "rated" when table 2 contains company from table 1 and "not rated" when company name does not exist in table 1.

 

Thanks for your help in advance.

NOTE: The number of columns in both the tables are different

1 ACCEPTED SOLUTION
TheoC
Super User
Super User

@KrtinM here is a measure you can use:

 

Measure = 

VAR _1 = MAX ('Table'[Company Name] )
VAR _2 = LOOKUPVALUE ( 'Table (2)'[Company Name] ,'Table (2)'[Company Name] , _1 )

RETURN

IF ( _2 = BLANK() , "Not Rated" , "Rated" )

Output per below:

 

TheoC_1-1652234636087.png

 

Thanks,

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

9 REPLIES 9
TheoC
Super User
Super User

@KrtinM here is a measure you can use:

 

Measure = 

VAR _1 = MAX ('Table'[Company Name] )
VAR _2 = LOOKUPVALUE ( 'Table (2)'[Company Name] ,'Table (2)'[Company Name] , _1 )

RETURN

IF ( _2 = BLANK() , "Not Rated" , "Rated" )

Output per below:

 

TheoC_1-1652234636087.png

 

Thanks,

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

danextian
Super User
Super User

Hi @Anonymous ,

You can have many solutions to this depending on how your data model is. If the subset contains unique company names, you can create a one to many relationship from that table to subset to the parent table using the company columns. In the parent table which is on the  many side  of the relationship ( assuming a company name appears more than one), you can create a calculated column similar to below:

 

Rated?(Column) =
IF ( RELATED ( Subset[Company] ) <> BLANK (), "Rated", "Not Rated" )

If you really want this as a measure, use this but that would be a double work.:  

Rated? (Measure) = 
SELECTEDVALUE (Parent[Rated?(Column)])


Alternatively, you can create  calulcated column in Parent using LOOKUP function.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Anonymous
Not applicable

Hi Thanks for your reply,

I already have a calculated column in parent with rated and non rated, problem is, when i select values from slicers in table b, it wont filter visuals made from table 1 because of the relationship.

@KrtinM here is a measure you can use:

 

Measure = 

VAR _1 = MAX ('Table'[Company Name] )
VAR _2 = LOOKUPVALUE ( 'Table (2)'[Company Name] ,'Table (2)'[Company Name] , _1 )

RETURN

IF ( _2 = BLANK() , "Not Rated" , "Rated" )

Output per below:

 

TheoC_0-1652234738936.png

 

Works with and without relationships.

 

Thanks,
Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

TheoC
Super User
Super User

Hi @Anonymous 

 

I created 2 tables. Company D is missing from Table 2.

Table 1: 

TheoC_0-1652229907513.png

Table 2:

TheoC_1-1652229923191.png

Ensure there's a relationship between the two:

TheoC_2-1652229934691.png

I then created a Calculated Column in Table 1 using RELATED and also using IF to determine if RELATED returns a Company. If it does, return "Rated" otherwise return "Not Rated".

 

_Rated = 

VAR _1 = RELATED ('Table (2)'[Company Name] )

RETURN

IF ( _1 = 'Table'[Company Name] , "Rated" , "Not Rated" )

Output is as follows:

TheoC_3-1652230043344.png

Hope this helps. PBIX file attached for further assistance.

 

Theo 🙂

 

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Anonymous
Not applicable

Thanks for your reply Theo, I already have a calculated column like that, issue being table 1 filters table 2, if I go with filter both sides, i get other issues, hence I want a measure so that relationship issues won't appear. Am i making sense, apologies new to Power BI.

@Anonymous here is a measure you can use:

 

Measure = 

VAR _1 = MAX ('Table'[Company Name] )
VAR _2 = LOOKUPVALUE ( 'Table (2)'[Company Name] ,'Table (2)'[Company Name] , _1 )

RETURN

IF ( _2 = BLANK() , "Not Rated" , "Rated" )

Output per below:

 

TheoC_0-1652234584854.png

 

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Hi @Anonymous ,

You can try this measure.

Rated/Not Rated =
VAR __count =
    CALCULATE (
        DISTINCTCOUNT ( 'Parent'[Company] ),
        FILTER ( 'Parent', 'Parent'[Company] IN VALUES ( 'Subset'[Company] ) )
    )
RETURN
    IF ( __count = BLANK (), "Not Rated", "Rated" )


Tested that it works with or without a relationshi between the two tables.

danextian_0-1652234260974.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@KrtinM here is a measure you can use:

 

Measure = 

VAR _1 = MAX ('Table'[Company Name] )
VAR _2 = LOOKUPVALUE ( 'Table (2)'[Company Name] ,'Table (2)'[Company Name] , _1 )

RETURN

IF ( _2 = BLANK() , "Not Rated" , "Rated" )

Output per below:

 

TheoC_0-1652235022208.png

 

 

Thanks,

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors