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! Request now

Reply
Tob_P
Helper V
Helper V

Count of metric based on match in 2 tables and no match in 3rd table

TobPLogs.png

 

Above is a screenshot of a file available at https://drive.google.com/file/d/1mc5nLhZwJAIrlg_P1fL5XwkzAmQloGqh/view?usp=sharing

 

I have my Sales Header, Sales Line and Log tables and I'm looking to create a measure whereby I get a match between the CQ number in the Sales Header and Line tables but not in the Log table. So in the example above, the measure would return 2 as CQ000033 is not listed in the Log table.

 

Can someone help with how I can go about achieving this please?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Tob_P ,

First of all, many thanks to @AndyEagleton  for your very quick and effective replies.

Based on my testing, please try the following methods as workaround:

1.Create the simple table.

vjiewumsft_0-1715320288521.png

2.Create the new measure to get a match between three table.

Measure = 
VAR SalesHeaderCQ = DISTINCT('Sales Header'[No])
VAR SalesLineCQ = DISTINCT('Sales Line'[No])
VAR LogCQ = DISTINCT('Log'[No])
VAR IntersectCQ = INTERSECT(SalesHeaderCQ, SalesLineCQ)
VAR ResultCQ = INTERSECT(LogCQ, IntersectCQ)
RETURN COUNTROWS(ResultCQ)

3.Drag the measure into the card visual. The result is shown below.

vjiewumsft_1-1715320310929.png

Best Regards,

Wisdom Wu

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

3 REPLIES 3
Anonymous
Not applicable

Hi @Tob_P ,

First of all, many thanks to @AndyEagleton  for your very quick and effective replies.

Based on my testing, please try the following methods as workaround:

1.Create the simple table.

vjiewumsft_0-1715320288521.png

2.Create the new measure to get a match between three table.

Measure = 
VAR SalesHeaderCQ = DISTINCT('Sales Header'[No])
VAR SalesLineCQ = DISTINCT('Sales Line'[No])
VAR LogCQ = DISTINCT('Log'[No])
VAR IntersectCQ = INTERSECT(SalesHeaderCQ, SalesLineCQ)
VAR ResultCQ = INTERSECT(LogCQ, IntersectCQ)
RETURN COUNTROWS(ResultCQ)

3.Drag the measure into the card visual. The result is shown below.

vjiewumsft_1-1715320310929.png

Best Regards,

Wisdom Wu

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

Thank you both for your replies and suggestions - went with the variable option and it worked a treat!

 

Thanks again.

AndyEagleton
Frequent Visitor

Somthing like this might work:

COUNTROWS( EXCEPT ( INTERSECT( VALUES(Header[CQ]), VALUES(Lines[CQ]) ), VALUES(Log[CQ]) ) ) 

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.