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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ReadTheIron
Helper III
Helper III

Filtering by occurences in another table

I'm dealing with incident classifications and trying to find out how many times a given type of incident was misclassified, based on a table that has multiple followup comments per incident. For instance, in the example below, I'm trying to find out how many incidents with the cause "NONE" contained comments that mention water.

 

ReadTheIron_0-1658498479486.png

The tables are related on the WorkOrder field, one to many.

 

I've written a measure, but it only gives me the total number of WorkOrders containing "water" in the comments field, even if I try to break it down by CauseCode:

WaterCount=CALCULATE(DISTINCTCOUNT('CommentsTable'[WorkOrder]),FILTER(ALL('CommentsTable'),SEARCH("water",'CommentsTable'[Comments],,BLANK()) >0))
 
Table I do not want
ReadTheIron_1-1658499183613.png

 

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @ReadTheIron ,

 

Please try these two measure to do that.

Total Incidents =
DISTINCTCOUNT ( CommentsTable[WorkOrder] )

watercount =
CALCULATE (
    DISTINCTCOUNT ( CommentsTable[WorkOrder] ),
    FILTER ( 'CommentsTable', CONTAINSSTRING ( [Comments], "water" ) )
)

 

Result:

vchenwuzmsft_0-1658829702722.png

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

4 REPLIES 4
v-chenwuz-msft
Community Support
Community Support

Hi @ReadTheIron ,

 

Please try these two measure to do that.

Total Incidents =
DISTINCTCOUNT ( CommentsTable[WorkOrder] )

watercount =
CALCULATE (
    DISTINCTCOUNT ( CommentsTable[WorkOrder] ),
    FILTER ( 'CommentsTable', CONTAINSSTRING ( [Comments], "water" ) )
)

 

Result:

vchenwuzmsft_0-1658829702722.png

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

Thank you! This worked perfectly - and helped me identify a big problem with our data. You've really helped me out!

ReadTheIron
Helper III
Helper III

Does this work:

 

WorkOrderCauseCodeDate
A001Wind1/1/2022
A002None1/2/2022
A003Fire1/3/2022
A004None1/3/2022
A005Water1/4/2022
A006None1/5/2022

 

WorkOrderComments
A001Fixed wind trouble
A002Problem not found
A002Water leak
A003Fixed fire trouble
A004Water leak found
A004Fixed water leak
A005Fixed water leak
A006Problem not found

 

vanessafvg
Super User
Super User

can you provide the data in text format?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.