Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DAX Power BI occurrences of character in string

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

like image 670
חִידָה Avatar asked Oct 15 '25 15:10

חִידָה


1 Answers

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.

like image 82
CR7SMS Avatar answered Oct 18 '25 08:10

CR7SMS