Forum Discussion

layheart's avatar
layheart
Regular Visitor
8 years ago
Solved

Dax Statement Help - Grouping codes by If statements

In my data set, I have a column of thousands of unique codes that are about 15 characters in length (ex. 17.26AZ85894) .  I am trying to find a solution to group them to easily sort the data.  I have...
  • stretcharm's avatar
    8 years ago

    Unless I'm missing something you can use not equal

     

    from the original code  

    IF( Left(Metric Table [Code],5) = "17.26"  && Left(Metric Table [Code],8) <> "17.264YZ" , "Bulk Equipment", "null") 

    or using 2 columns

     

     

     IF( Metric Table [Stem +2] = "17.26"  && Metric Table [Stem +5] <> "17.264YZ" , "Bulk Equipment", "null")

    You can also do similar functions in M (Query Editor)

     

    Depending on what your data looks like you may be better creating a mapping table and joining the code or a sub part of the code to the mapping table.

     

    For smaller grouping exerecises try the group banding feature. Right click on a column and select New Group.