powerbidaxpowerbi-desktop

Attempting to count affected rows, not total occurrences of a keyword


I am attempting to count the number of application's comments that include a key word, not the total count of the keyword.

i.e. creating the measure on the right from the table on the left.

enter image description here

I have put together this measure, but this counts the total amount of keyword occurrences.

Applications with Keywords Count Measure =
VAR _search_word =
    SELECTEDVALUE ('Keywords Table'[Keywords])
VAR _result =
    CALCULATE (
        COUNTROWS ( 'Application Detail Table' ),
        CONTAINSSTRING ( 'Application Detail Table'[Comments], _search_word )
    )
RETURN
    _result

Please help!

Thank you!

I attempted to use the above formula, and cannot determine how many applications are affected, only total number of keywords occurrences.


Solution

  • If i got your point correctly,To count the number of application's comments that include a key word, not the total count of the keyword,Please try below measure..

    VAR _search_word =
        SELECTEDVALUE ('Keywords Table'[Keywords])
    VAR _result =
        CALCULATE (
            DISTINCTCOUNT ( 'Application Detail Table'[ApplicationID] ),
            CONTAINSSTRING ( 'Application Detail Table'[Comments], _search_word )
        )
    RETURN
        _result