Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Filter to value ends with "

Hi All,

 

I have a measure that I would like to filter to a value that ends with " but it is showing error. Does anyone know how I can filter the value in measure?

 

Measure = Calculate (SUM(Units), Segment = "<10"")

 

Thanks,

Bee Kee

  • Hi, Anonymous 

    According to your description and DAX formula, you want to filter the table which ends with <10”, but you get an error, right? I think this is because you have to use “" to replace the “ in the original text vale, you can try my measures:

    This is my test data:

     

    Measure =
    
    CALCULATE(SUM('Table'[Units]),FILTER('Table',RIGHT([Segment],4)="<10"""))
    Measure 2 =
    
    CALCULATE(SUM('Table'[Units]),FILTER('Table',SEARCH("<10""",[Segment],1,0)))

    And you can get what you want, like this:

     

    You can download my test pbix file here

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

     

    Best Regards,

    Community Support Team _Robert Qin

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

2 Replies

  • Anonymous , Additional double quote. Try like

    Measure = Calculate (SUM(Units), Segment = "<10")

     

    Measure = Calculate (SUM(Units), filter(Table, [Segment] = "<10"))

  • v-robertq-msft's avatar
    v-robertq-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous 

    According to your description and DAX formula, you want to filter the table which ends with <10”, but you get an error, right? I think this is because you have to use “" to replace the “ in the original text vale, you can try my measures:

    This is my test data:

     

    Measure =
    
    CALCULATE(SUM('Table'[Units]),FILTER('Table',RIGHT([Segment],4)="<10"""))
    Measure 2 =
    
    CALCULATE(SUM('Table'[Units]),FILTER('Table',SEARCH("<10""",[Segment],1,0)))

    And you can get what you want, like this:

     

    You can download my test pbix file here

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

     

    Best Regards,

    Community Support Team _Robert Qin

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