Forum Discussion
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
- gazzo1967
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 - AnonymousNot 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 _ RongtieIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.