Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Contains function not returning the correct value

Hi All,

I have written the below code but it is not giving me expected result. Can anyone suggest me where I'm doing mistke.

 

Measure 2 = CONTAINS(YOY_Cumulative,'YOY_Cumulative'[Name],"2015")
 
In the above dax 'YOY_Cumulative' - is my table anme
                            'YOY_Cumulative'[Name] - is my column name
                             "2015": is the value I'm checking
 
The 'YOY_Cumulative'[Name] column contsin value like 2015 Cumulative lab, 2015 cumulative rx, 2016 Cumulative lab,Cumulative rx like this.
 
So for the column containg 2015 it should return True, but it is returning False.
 
Thanks,
Anand
  • Hi Anonymous 

    Use this measure

     

     

    Measure 2 = CONTAINSSTRING(MAX('YOY_Cumulative'[Name]), "2015")

     

     

    Regards

    Phil

3 Replies

  • Anonymous , try of this can work

    containsstring('YOY_Cumulative'[Name],"2015")

  • Hi Anonymous 

    Use this measure

     

     

    Measure 2 = CONTAINSSTRING(MAX('YOY_Cumulative'[Name]), "2015")

     

     

    Regards

    Phil

  • Anonymous's avatar
    Anonymous
    Not applicable

    It works thanks Phil.