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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Tob_P
Helper IV
Helper IV

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
v-jiewu-msft
Community Support
Community Support

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
v-jiewu-msft
Community Support
Community Support

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors