Forum Discussion

MSargeant's avatar
MSargeant
Frequent Visitor
3 years ago
Solved

DAX for Counting Rows Specific Words and Phrases in Long Text for a Card Visual

Hi Everyone, I am trying to create DAX for a card visual that searches a long comment text field in the fact table and returns the number of rows that contain specific key words and phrases.I've tri...
  • AnthonyGenovese's avatar
    AnthonyGenovese
    3 years ago

    Yah, In doesn't work like that. You will need to do something like

    # Strikes = 
     CALCULATE(
    [Business Days (System) - Annual],
    OR(
    OR(
    OR(
    OR(
    CONTAINSSTRING( 'Work List'[Incident Text], "HITTING" ),
    CONTAINSSTRING( 'Work List'[Incident Text], "STRIKING" )
    ),
    CONTAINSSTRING( 'Work List '[Incident Text], "HIT" )
    ),
    CONTAINSSTRING( 'Work List'[Incident Text], "STRUCK" )
    ),
    CONTAINSSTRING(
    'Work List'[Incident Text],
    "COMING INTO CONTACT WITH"
    )
    ),
    'Work List'[Category Description] = "Management Failure"
    )

     

    If it were me, I would flag all the incident text you are trying to search for, in Power Query and using a new column. The change the measure to simply return the flag=1/Y or whatever.

    If this post was helpful, please kudos or accept the answer as a solution.
    ~ Anthony Genovese
    Need more PBI help? PM me for affordable, dedicated training or consultant recomendations!