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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
vnqt
Helper V
Helper V

Compliance check of 2 tables

Hi,

 

I have 2 tables A and B without direct relation.

 Table A there are 3000 Names and 2000 names in Table B 

I would like to compare the name of 2 tables to check the compliance of these 2 tables :

- number of same names (Card view)

- number of different names (Card view)

and a list (table view) of these same and different names. 

 

Could you please advise? 

Thank you in advance.

Tg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @vnqt ,

 

I suggest you to create a DimName table with all distinct names and then do calculation based on this table.

DimName = 
VAR _UNION = UNION(VALUES('Table A'[Name]),VALUES('Table B'[Name]))
RETURN
SUMMARIZE(_UNION,[Name])

My Sample is as below.

Table A:

RicoZhou_0-1669796990946.png

Table B:

RicoZhou_1-1669796999263.png

Measure:

number of same names =
CALCULATE (
    COUNT ( DimName[Name] ),
    FILTER (
        DimName,
        AND (
            DimName[Name] IN VALUES ( 'Table A'[Name] ),
            DimName[Name] IN VALUES ( 'Table B'[Name] )
        )
    )
)
number of different names = CALCULATE(COUNT(DimName[Name])) - [number of same names]
Filter Same list =
IF (
    AND (
        SELECTEDVALUE ( DimName[Name] ) IN VALUES ( 'Table A'[Name] ),
        SELECTEDVALUE ( DimName[Name] ) IN VALUES ( 'Table B'[Name] )
    ),
    1,
    0
)

Result is as below.

Add [Filter Same list] into Same Name list (visual level filter) and set it to show items when value = 1.

Add [Filter Same list] into Different Name list (visual level filter) and set it to show items when value = 2.

RicoZhou_2-1669797178344.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @vnqt ,

 

I suggest you to create a DimName table with all distinct names and then do calculation based on this table.

DimName = 
VAR _UNION = UNION(VALUES('Table A'[Name]),VALUES('Table B'[Name]))
RETURN
SUMMARIZE(_UNION,[Name])

My Sample is as below.

Table A:

RicoZhou_0-1669796990946.png

Table B:

RicoZhou_1-1669796999263.png

Measure:

number of same names =
CALCULATE (
    COUNT ( DimName[Name] ),
    FILTER (
        DimName,
        AND (
            DimName[Name] IN VALUES ( 'Table A'[Name] ),
            DimName[Name] IN VALUES ( 'Table B'[Name] )
        )
    )
)
number of different names = CALCULATE(COUNT(DimName[Name])) - [number of same names]
Filter Same list =
IF (
    AND (
        SELECTEDVALUE ( DimName[Name] ) IN VALUES ( 'Table A'[Name] ),
        SELECTEDVALUE ( DimName[Name] ) IN VALUES ( 'Table B'[Name] )
    ),
    1,
    0
)

Result is as below.

Add [Filter Same list] into Same Name list (visual level filter) and set it to show items when value = 1.

Add [Filter Same list] into Different Name list (visual level filter) and set it to show items when value = 2.

RicoZhou_2-1669797178344.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

djurecicK2
Super User
Super User

Hi @vnqt ,

 You can use the LOOKUPVALUE function to compare fields from tables that are not related.

 

https://learn.microsoft.com/en-us/dax/lookupvalue-function-dax

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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