Forum Discussion

amani1980's avatar
amani1980
Frequent Visitor
1 year ago
Solved

Containsstring to compare two columns...

Hi,   I have two tables    I want to compare Series with Runs and return an output of the number of occurances of each of the strings in Runs table as a new column COUNTS. Basically in this...
  • DataNinja777's avatar
    1 year ago

    Hi amani1980 ,

     

    You can achieve your goal by writing a measure like the one below:

    CountsMeasure = 
    VAR CurrentSeries = SELECTEDVALUE(Series[Series])
    RETURN
    SUMX(
        Runs,
        IF(CONTAINSSTRING(Runs[Runs], CurrentSeries), 1, 0)
    )
    

    You can either use this measure in a calculated column, as shown below, or place it next to the Series rows in the matrix visual, as demonstrated in the one below.

     

    I have attached an example pbix file for your reference.