Forum Discussion
BeckyPeppin
9 years agoRegular 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...
- 9 years ago
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) )
Phil_Seamark
9 years agoMicrosoft 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)
)- BeckyPeppin9 years agoRegular Visitor
Thank you so much!
- CAPEconsulting9 years agoHelper III
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