Forum Discussion

JensHN's avatar
JensHN
Frequent Visitor
7 years ago
Solved

Count rows containing different specifc text

Hi,   my datamodel contains two tables. First table is "Jobs" with an "Attributes" filed:     Second table is "Attribute" with a "Name" filed.   There is no connection between these ta...
  • Stachu's avatar
    7 years ago

    this will work

    Measure = 
    VAR _Attribute = SELECTEDVALUE(Attribute[Name],BLANK())
    VAR _SearchFlag = ADDCOLUMNS(Jobs,"Flag",SEARCH(_Attribute,Jobs[Attributes],1,BLANK()))
    VAR _RelevantRows = FILTER(_SearchFlag,[Flag]<>BLANK()) 
    RETURN
    COUNTROWS(_RelevantRows)

    you need to use Name from Attribute table and measure in the visual, there should be no joins between the tables
    it does the job, but search will affect the performance badly (it has to iterate every string in the Jobs table), so the performance may not be great for bigger datasets