Forum Discussion

New_Folder's avatar
New_Folder
Helper I
1 year ago
Solved

How do I COUNT IF CONTAINS?

How do I count the number of colors in Table1, Value if it CONTAINS the color in Table 2 Color

 

I tried the formula below but it only counts the actual Value but not IF IT CONTAINS

 
COUNT = CALCULATE(
COUNTROWS('Table 1')
 

 

  • New_Folder,

     

    Try this calculated column in Table2:

     

    Count =
    VAR vColor = Table2[Color]
    VAR vResult =
        COUNTROWS ( FILTER ( Table1, CONTAINSSTRING ( Table1[Value], vColor ) ) )
    RETURN
        vResult

     

     

1 Reply

  • New_Folder,

     

    Try this calculated column in Table2:

     

    Count =
    VAR vColor = Table2[Color]
    VAR vResult =
        COUNTROWS ( FILTER ( Table1, CONTAINSSTRING ( Table1[Value], vColor ) ) )
    RETURN
        vResult