Forum Discussion

DHB's avatar
DHB
Helper V
9 years ago
Solved

Switch groups in 100% Stacked chart

I'm using a 100% Stacked chart and the legend is either Y or N.  I have the N coming up at the bottom of the bar and Y from the top.  Is there any way I can switch those two around so that Y starts at the bottom?

 

Thank you,

 

DHB

 

 

  • There sure is.  Just add a new column to your table that will control the sort order of your Legend column

     

    So please add the following column 

    Legend Sort = IF('mytable'[Legendcol] = 'Y' , 0 , 1 )

     

    Then specify the sort order of your existing column to use this new column using the Sort By Column feature

     

7 Replies

  • Phil_Seamark's avatar
    Phil_Seamark
    Microsoft Employee

    There sure is.  Just add a new column to your table that will control the sort order of your Legend column

     

    So please add the following column 

    Legend Sort = IF('mytable'[Legendcol] = 'Y' , 0 , 1 )

     

    Then specify the sort order of your existing column to use this new column using the Sort By Column feature

     

    • DHB's avatar
      DHB
      Helper V

      That's great thanks Phil.

       

      The issue I have now is that I can't sort another column in the same table.   It says Sort By Another Column Error - This column can't be sorted by a column that is already sorted, directly or indirectly , by this column.  Can I only do this once per table?

      • Phil_Seamark's avatar
        Phil_Seamark
        Microsoft Employee

        Oh ok, it looks like you can't then.  I haven't come across that.  I take it you have another Y/N column in your table?

         

        Perhaps just create some more sorting columns (which you can hide)