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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
android1
Post Patron
Post Patron

CALCULATE count of several text values

Hi,

 

I am rying to calculate the number of times 3 different strings appear in a column.

This measure works for one value -> CountPunctuality = CALCULATE(COUNTROWS(OTIF),OTIF[Punctuality] = "On Time")

 

 

I need to also count the number of times 2 other strings appear in the same column. Tried using or , & but nothing's working.

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

@android1 You can either create Measures for EACH one - the same as before

Just change "On Time" - so you'll have 3 Measures

Or do as in the picture...

Create a Table => drag the column twice to the Values area => the second column change to Count

This is faster but you'll have more flexibility later on if you create the individual Measures

IF - Arrival Time - Late or On Time.png

View solution in original post

5 REPLIES 5
Sean
Community Champion
Community Champion

@android1 Try this...

 

CountPunctuality =
COUNTROWS ( FILTER ( OTIF, OTIF[Punctuality] = "On Time" ) )

Hi Sean,

 

How do I add 2 more text values to this. I want to count the number of times 'On Time', 'Late', 'Early' 

appears in the column.

 

Thanks

Sean
Community Champion
Community Champion

@android1 You can either create Measures for EACH one - the same as before

Just change "On Time" - so you'll have 3 Measures

Or do as in the picture...

Create a Table => drag the column twice to the Values area => the second column change to Count

This is faster but you'll have more flexibility later on if you create the individual Measures

IF - Arrival Time - Late or On Time.png

Anonymous
Not applicable

I have a question that is a bit similar, but i need to make a distinct count

That's great. Thanks for your help Sean.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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