Forum Discussion

StuBee's avatar
StuBee
Helper I
3 years ago
Solved

Switch Table Custom Format failing to sort data correctly

Hello,   When I use a custom format on my data, the data gets sorted based on the first number as shown below.     This is the code I am using, I have tried with max instead of values and wit...
  • daXtreme's avatar
    3 years ago

    Hi StuBee 

     

    It's a bad idea, indeed, to format a numeric measure with FORMAT and return a string (unless you need to incorporate such a value into some kind of text but even then you create a version of the measure). Such "values" will always be sorted as strings, not numbers. That's one thing. A measure should always return the raw value (always of the same type). Mixing floats with integers is a NO-NO. Measures should be consistent. Otherwise you'll be facing issues. And, as we see, you do. Formatting a measure should be done in the UI option in the ribbon. So, if you have a measure that wants to return different types of info, you're most likely doing it wrong. You should rethink the design.