Forum Discussion
Luzadriana255
Helper II
3 years agoCounting specific words on a string (in DAX)
Hello, In Power BI, I have a table with a column called Status that combines different words with 4 characters. I need to count how many times each of these 4 character words appears in the Status c...
- 3 years ago
Luzadriana255 Try:
Measure = VAR __Status = MAX('Table2'[STATUS]) VAR __Len1 = LEN(__Status) VAR __String = CONCATENATEX('Table',[STATUS],",") VAR __Len2 = LEN(__String) VAR __String2 = SUBSTITUTE(__String, __Status, "") VAR __Len3 = LEN(__String2) VAR __Num = DIVIDE(__Len2 - __Len3, __Len1) VAR __Result = IF(__Status = "", COUNTROWS(FILTER('Table',[STATUS] = "")),__Num) RETURN __ResultPBIX is attached below signature.
Greg_Deckler
Community Champion
3 years agoLuzadriana255 Did you download and review the attached PBIX? Because it works there. I implemented the individual statuses as a disconnected table (in my PBIX Table2) Table2 status column is used in the visual along with the measure.
Luzadriana255
Helper II
3 years agoGreg_Deckler I had not open that document before. Now it is clear and it works properly. Thank you!