Forum Discussion

jski's avatar
jski
Frequent Visitor
7 years ago
Solved

helper column to sort legend dynamically

Hello, I have a dimension on legend that I need to sort dynamically. I can't add a sort order column that is hardcoded. I need the values in the sort column to populate dynamically based on another ...
  • Anonymous's avatar
    Anonymous
    7 years ago

    HI jski ,

    You can consider to create a sort table with unique fields value and index fields on datasource side.
    After this, you can use index column as 'sort by column as' of value field, use this value field to create relations mapping to draw table and use new table value fields as legend.(legend field sort order will changes based on index which you set up on datasource side)

    If you want this table only exist on power bi side, you can extract all color value from raw table and remove duplicate value, create a calculated column with switch function to define their index.(sort order will changes if you modify formula conditions)

    Regards,

    Xiaoxin Sheng