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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 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.