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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
NingMel
Frequent Visitor

How to countrow with multiple values

I have this:

WO with Code TF1 = COUNTROWS(
FILTER(
WORK_ORDER, CONTAINS(RELATEDTABLE(EQUIPMENT), EQUIPMENT[EQUIPMENT_CATEGORY_CODE] , "TF1") ))
 
WO with Code TF2 = COUNTROWS(
FILTER(
WORK_ORDER, CONTAINS(RELATEDTABLE(EQUIPMENT), EQUIPMENT[EQUIPMENT_CATEGORY_CODE] , "TF2") ))
 
I want to use just one command (combine them together).  I want to count WO if it has EQUIPMENT[EQUIPMENT_CATEGORY_CODE] either TF1 or TF2.  I tried below but it doesn't work.
 
COUNTROWS(
FILTER(
WORK_ORDER, CONTAINS(RELATEDTABLE(EQUIPMENT), EQUIPMENT[EQUIPMENT_CATEGORY_CODE]  in { "TF1", "TF2" } ) ))
 
Any suggestions?
 
1 ACCEPTED SOLUTION
SpartaBI
Community Champion
Community Champion

@NingMel try this:

WO with Code TF1 or TF2 =
COUNTROWS (
    FILTER (
        WORK_ORDER,
        CONTAINS (
            RELATEDTABLE ( EQUIPMENT ),
            EQUIPMENT[EQUIPMENT_CATEGORY_CODE], "TF1"
        )
            || CONTAINS (
                RELATEDTABLE ( EQUIPMENT ),
                EQUIPMENT[EQUIPMENT_CATEGORY_CODE], "TF2"
            )
    )
)

View solution in original post

3 REPLIES 3
SpartaBI
Community Champion
Community Champion

@NingMel try this:

WO with Code TF1 or TF2 =
COUNTROWS (
    FILTER (
        WORK_ORDER,
        CONTAINS (
            RELATEDTABLE ( EQUIPMENT ),
            EQUIPMENT[EQUIPMENT_CATEGORY_CODE], "TF1"
        )
            || CONTAINS (
                RELATEDTABLE ( EQUIPMENT ),
                EQUIPMENT[EQUIPMENT_CATEGORY_CODE], "TF2"
            )
    )
)

@SpartaBI Thank you so much it works!!!  I knew it was something to do with this || but I never use it before.  I tried below but it didn't work.  Anyway thank you so much.

 
EQUIPMENT[EQUIPMENT_CATEGORY_CODE] in { "TF' ,"TF2"}
SpartaBI
Community Champion
Community Champion

@NingMel my pleasure 🙂

Please don't forget to accept my previuos reply as a solution for community viasabilty and appreciate your kudos 🙂

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.