Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Solved! Go to Solution.
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:
Table B:
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.
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.
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:
Table B:
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.
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.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
44 | |
25 | |
19 | |
16 | |
8 |
User | Count |
---|---|
70 | |
49 | |
45 | |
20 | |
16 |