Forum Discussion

VictorSunrise's avatar
VictorSunrise
New Member
2 years ago
Solved

Help to Count Number of Locations [Project Count]

I've been trying to count the number of projects in the locations table here, but nothing seems to work when commas are present.  Is there any way to do this using CONTAINSSTRING?  I don't want to ad...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi VictorSunrise ,

     

    I made simple samples and you can check the results below:

    Count = 
    VAR _ADD = ADDCOLUMNS(ALLSELECTED('Table'),"Flag",IF(CONTAINSSTRING([Project Location],SELECTEDVALUE('DimProject Location'[Project Location])),1,0))
    RETURN
    SUMX(_ADD,[Flag])

     

    Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.