Forum Discussion

Nie's avatar
Nie
Helper I
3 years ago
Solved

Check Values in Column Against List

I want to write a measure to check if a column contains certain numerical values that I specify. These values are something like "2022, 2021, 2019" and may change.   I looked at various formulas an...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Nie ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) This is my test data. 

    (2) Create a parameter of type number.

     

    (3) Then we can create a measure.

    Measure = 
    var _a = SELECTCOLUMNS('Parameter',"Value",[Parameter])
    var _b = ADDCOLUMNS(_a,"Flag",IF([Value] in SELECTCOLUMNS('Table',"Target",[Column1]),1,0))
    var _c = COUNTX(_a,[Value])
    return SUMX(_b,[Flag])=_c

    (4)Then the result is as follows.

    Best Regards,

    Neeko Tang

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