Forum Discussion

matthierry's avatar
matthierry
New Member
3 years ago
Solved

How to create a new field taking a variable and filtering it

 

I woul like to create a new value using the field GOO_MAJOR_REFERENCE but filtering it, I just need the data that are located before the "." of the reference. 

How is that possible ? 

Thanks

 

  • AmiraBedh's avatar
    AmiraBedh
    3 years ago

    When you said the data before "." you didn't precise if it is to the LEFT or to the RIGHT.

    You can use the following syntax to create your calculated column : 

    NewReference = LEFT('MyTable'[GOO_MAJOR_REFERENCE]FIND("."'MyTable'[GOO_MAJOR_REFERENCE])-1)

     

    The error you are getting is related to an extra ) at the end.

5 Replies

  • Assuming this is the output you want : 

    You need to create a calculated column not a measure to achieve your result : 

    NewReference = RIGHT('MyTable'[GOO_MAJOR_REFERENCE], FIND(".", 'MyTable'[GOO_MAJOR_REFERENCE])-1)
    • matthierry's avatar
      matthierry
      New Member

      Thanks a lot for your feedback, Actually I need the data before the "." so I used left instead, but I get an error. 

       

      Is there something i'm doing wrong ? 

       

       

      • AmiraBedh's avatar
        AmiraBedh
        Icon for Super User rankSuper User

        When you said the data before "." you didn't precise if it is to the LEFT or to the RIGHT.

        You can use the following syntax to create your calculated column : 

        NewReference = LEFT('MyTable'[GOO_MAJOR_REFERENCE]FIND("."'MyTable'[GOO_MAJOR_REFERENCE])-1)

         

        The error you are getting is related to an extra ) at the end.