Forum Discussion
gingerclaire
3 years agoHelper III
Count instance of string in column
I have a table (L&L) as below which is connected to my date table: Date Job role codes concatenated 01/11/22 123b4, 34b56, 2b343, 3a421 03/11/22 123b4, 34b56, 2b343, 3a421 ...
Greg_Deckler
3 years agoCommunity Champion
gingerclaire You can either use Power Query Editor to split that column on commas and the unpivot or you could do this:
Measure =
VAR __Code = MAX('Table2'[Code])
VAR __Table = FILTER('Table1',CONTAINSSTRING([Job role codes concatenated],__Code))
VAR __Result = COUNTROWS(__Table)
RETURN
__Result- gingerclaire3 years agoHelper III
Thank you! I used this and it is working in a table BUT it is using COUNTROWS so is giving me the wrong totals - but i think i worked out why!
One a single row there might be several instances of the same string i.e. each row is an event and there might be 5 or six vets at that event. So it needs to count how often the string/code appears.
Is there a way to do this please?