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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
gazzo1967
Helper III
Helper III

Help with SEARCH for multiple Values from one Column (Is my logic flawed or my syntax?)

Hi All
Just looking for some direction 😊
I have a formula that is working fine.

COUNT_WCdr = CALCULATE(

    COUNTROWS(GN_EMPLOYEE_DATA),

    SEARCH("Watch Commander",GN_EMPLOYEE_DATA[JOB_TITLE],,0)

    && SEARCH("(OPS)",GN_EMPLOYEE_DATA[JOB_TYPE],,0)

       )+0


As you can see it searches from 2 different columns and works fine.
So my question is why does the formula not work when add another search from one of the columns used as an OR

Example

COUNT_WCdr = CALCULATE(

    COUNTROWS(GN_EMPLOYEE_DATA),

    SEARCH("WCdr",GN_EMPLOYEE_DATA[JOB_TITLE],,0)

    && SEARCH("(OPS)",GN_EMPLOYEE_DATA[JOB_TYPE],,0)

    || SEARCH("Department",GN_EMPLOYEE_DATA[JOB_TYPE],,0)              /*added parameter*/

    )+0

Any help given is great and another learning step for me 😎
Gary

2 REPLIES 2
Anonymous
Not applicable

Hi @gazzo1967 ,

Please have a try.

Modify the formula.

COUNT_WCdr =
CALCULATE (
    COUNTROWS ( GN_EMPLOYEE_DATA ),
    (
        SEARCH ( "Watch Commander", GN_EMPLOYEE_DATA[JOB_TITLE],, 0 )
            && SEARCH ( "(OPS)", GN_EMPLOYEE_DATA[JOB_TYPE],, 0 )
    )
        (|| SEARCH ( "Department", GN_EMPLOYEE_DATA[JOB_TYPE],, 0 )) + 0
)

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

 

gazzo1967
Helper III
Helper III

I also tried this

COUNT_WCdr = CALCULATE( COUNTROWS(GN_EMPLOYEE_DATA),
CONTAINS(GN_EMPLOYEE_DATA,
GN_EMPLOYEE_DATA[JOB_TITLE], "Watch Commander"),
OR( CONTAINS(GN_EMPLOYEE_DATA, GN_EMPLOYEE_DATA[JOB_TYPE], "(OPS)"), CONTAINS(GN_EMPLOYEE_DATA, GN_EMPLOYEE_DATA[JOB_TYPE], "Department") ) )

But i get a syntax of too many CONTAINS

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.