Forum Discussion

ThuJa23's avatar
ThuJa23
Icon for Advocate II rankAdvocate II
4 years ago
Solved

Custom legend by DAX measure

Hello everyone, 

 

I have been working with multidimension data source in Power BI. With live connect, all the functions as create column/table/sort column or even data field are hidden in Power BI desktop. 

I have a clustered column chart now, I want to sort the legend from left to right with Monat 3, then Monat 2, Monat 1, and last will be Actual date. But I can just only can use creating DAX measure to do this sort as all other functions are hidden. I do not know which DAX measure I should write in this case to reorder the positions of these column. I tried Switch measure, but then cannot drag this to legend field. 

Anyone can help me in this case?

Thanks so much for your helps!

  • ThuJa23 , Legend can be sorted ascending or on the sort column, but that you have to do in your tabular model.

     

    In case you need measures, you need to create 4 measures and put them in the order you want.

     

5 Replies

  • ThuJa23 , Legend can be sorted ascending or on the sort column, but that you have to do in your tabular model.

     

    In case you need measures, you need to create 4 measures and put them in the order you want.

     

    • ThuJa23's avatar
      ThuJa23
      Icon for Advocate II rankAdvocate II

      Hi amitchandak ,

      Could your please share me more detail or example of creating 4 more measures?

      It would be great as I'm still new in Power BI

       

      Thanks so much for your helps!

      Thu

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

        ThuJa23 , Ypu Can create like

         

        New measure

         

        Monat -3 =  calculate([Measure], filter(Table, Table[Legend column] = "Monat -3")

         

        Legend column is a column used in the legend

        Measure is existing measure

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    you can write separate measures for all your categories and then put them in the chart in the order you want