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
chris_jones
New 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?

1 ACCEPTED SOLUTION
dedelman_clng
Community Champion
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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@chris_jones ,

Total Count = CALCULATE ( COUNTROWS ( 'MyData' ), 'MyData[Fruit] in { "APPLE","PEAR","PLUM" } )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
dedelman_clng
Community Champion
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

Thank you @dedelman_clng 

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.