2

-- my DAX formula is unable to count the occurrences of a "," (comma) in a string from Column2, in a specific "Category" row. --

Formula = CALCULATE( COUNTAX( FILTER ('Query1', 'Query1'[Col1] = "Category", 'Query1'[Col2] = ",") ) )

-- Any suggestions? --

חִידָה
  • 259
  • 1
  • 2
  • 14

2 Answers2

5

You can use the following coulmn calculation to count the number of comma in a string:

Check = LEN(Query1[Col2])-LEN(SUBSTITUTE(Query1[Col2],",",""))

If you need the overall count, you can simply sum up the calculated field. Hope this helps.

CR7SMS
  • 2,520
  • 1
  • 5
  • 13
0

This should do the trick without the need of a calculated column

Formula :=
CALCULATE (
    COUNTROWS ( FILTER ( 'Query1', FIND ( ",", 'Query1'[Col1],, 0 ) > 0 ) ),
    'Query1'[Col2] = "Category"
)
StelioK
  • 1,771
  • 1
  • 11
  • 21