Forum Discussion
chris_jones
6 years agoNew Member
Counting three text value in a column
Hi,
I have one expression that works for only one value but having issues trying to expand it for three.
Example - That works for just counting how many times APPLE is listed in the Fruit Column
Total Count = CALCULATE ( COUNTROWS ( 'MyData' ), 'MyData[Fruit] = "APPLE" )
I want to count how many times, APPLE, PEAR or PLUM are in the same column.
Any Help?
Hi chris_jones - use the OR command or the || method
Total Count = CALCULATE ( COUNTROWS ( 'MyData' ), OR('MyData[Fruit] = "APPLE", OR('MyData[Fruit] = "PEAR", 'MyData[Fruit] = "PLUM"))) Total Count = CALCULATE ( COUNTROWS ( FILTER( 'MyData' ), 'MyData[Fruit] = "APPLE" || 'MyData[Fruit] = "PEAR" || 'MyData[Fruit] = "PLUM"))Either of those should work.
Hope this helps
David
3 Replies
- amitchandak
Super User
Total Count = CALCULATE ( COUNTROWS ( 'MyData' ), 'MyData[Fruit] in { "APPLE","PEAR","PLUM" } )
- dedelman_clng
Community Champion
Hi chris_jones - use the OR command or the || method
Total Count = CALCULATE ( COUNTROWS ( 'MyData' ), OR('MyData[Fruit] = "APPLE", OR('MyData[Fruit] = "PEAR", 'MyData[Fruit] = "PLUM"))) Total Count = CALCULATE ( COUNTROWS ( FILTER( 'MyData' ), 'MyData[Fruit] = "APPLE" || 'MyData[Fruit] = "PEAR" || 'MyData[Fruit] = "PLUM"))Either of those should work.
Hope this helps
David
- chris_jonesNew Member
Thank you dedelman_clng