Forum Discussion

melimob1's avatar
melimob1
Helper I
1 year ago
Solved

MEASURE - CONTAINSTRING - MULTIPLE TEXT

Hi, I have the below measure but it's not returning the correct results.

(dummy text as example)

I want to search column and count every time 'apples' or 'oranges' appear.

 

Total Client Count FRUIT  = 
CALCULATE(
    COUNT(_3_DataSet[Client]),
    CONTAINSSTRING(_3_DataSet[field], "APPLES" ),
        CONTAINSSTRING (_3_DataSet[field], "ORANGE" )
    )

 

 data set may look like this

ClientField 
aapple 
borange, apple 
capple, orange 
dorange, other 
eburger 

 

my result should be: 4 as their are 4 rows containing at least the fruit I was looking for.

 

Any help appreciated,

thanks

 

5 Replies

  • actually, think I have just got it to work but would appreciate advice.. I added

    || after the first containstring... does this stand for 'or'?

     

    many thanks

      • melimob1's avatar
        melimob1
        Helper I

        thank you so much!! am new to PBI and haven't come across this yet!! very good to know!

        may I ask, what is the code for 'AND'?  is it + or & or and or something completley different?