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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
BeckyPeppin
Regular Visitor

DAX function to count specific text values from a column

I have a column of text that I need to count specific text.  Here is a small sample:

 

Classification

Injury

Environmental;Near Miss

Injury;Environmental

Near Miss; Injury

Near Miss

Equipment Damage

 

I need help with a formula that will count Near Miss from the Classification Column.  In the data sample above, I'd expect Near Miss to count 3 times.

 

I'm sure this is simple, but for some reason I can't get it!

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @BeckyPeppin

 

Is this along the lines of what you need?

 

It's a calculated measure

 

My Count = CALCULATE(
		COUNTROWS('Table3'),
		SEARCH(
			"Near Miss",'Table3'[Classification],,0)
			)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @BeckyPeppin

 

Is this along the lines of what you need?

 

It's a calculated measure

 

My Count = CALCULATE(
		COUNTROWS('Table3'),
		SEARCH(
			"Near Miss",'Table3'[Classification],,0)
			)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

I am doing something similar and have 2 options

 

Asthma Prev = CALCULATE(COUNT(Epi[asthma active]),Epi[asthma active] = "true")/COUNT(Epi[ID])

or

Asthma Prev = CALCULATE(COUNTROWS(Epi),Epi[asthma active] = "true")/COUNT(Epi[ID])

 

Both give the same answer. Could you tell me the differences in the 2 apparoaches and which one to go for.

 

Also Asthma Prev = CALCULATE(COUNTA(Epi[asthma active]),Epi[asthma active] = "true")/COUNT(Epi[ID]) is alsoe giving me the same answr. ALL 3 OPTIONS SEEMS TO WORK. Butnot sure which one is BEST

Thank you so much!

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.