Forum Discussion

afaherty's avatar
afaherty
Icon for Helper V rankHelper V
4 years ago
Solved

"Sort By Column" changes stacked bar chart (DAX Related)

Hello,

I am running into a strange issue.  For my stacked bar chart below, I want to change the order in the visual so that "N/A" is last.

 

 

I tried this 2 ways:

1.)  Created a new table of the legend items above, with a column for "order."  I then created a new column in the original data table using RELATED to pull in the order into the original data table.

2.)  Inserted a new conditional column, assigning each legend item an order number (consistently = 1, inconsistely = 2, etc).

 

Both of these solutions caused this to happen once I did the whole "Sort By Column" thing:

 

 

Google cant seem to help.  Anyone have any ideas? Thanks everyone!

 

 

5 Replies

  • ValtteriN's avatar
    ValtteriN
    Icon for Community Champion rankCommunity Champion

    Hi,

    I am having trouble re-creating your issue. The only explanation that came to my mind is that the sort is somehow messing with your calculation logic (though I can't fathom why). In my test data I built a relation between the table and sort table and used related and used RELATED to get the sort column. Then I sorted the category table's category using this sort column and everything works fine:

     

    Could you provide some more information on your problem?

    • afaherty's avatar
      afaherty
      Icon for Helper V rankHelper V

      ValtteriN 

      Thank you for your help!  Here is a file of example data and I am experiencing the same behavior in this example data.  When I sort "Survey Question" by "Survey Question Sort," then all of the percentages on my stacked bar chart change to 100%.  If I sort "Survey Question" by itself, then this does not happen and the percentages are all correct.

       

      Example File - Sort/Stacked Bar Chart Problem 

       

      (I wish I could just attach it right here to this post but I don't have that option - I think it's because I'm still a bit of a newbie).

      • ValtteriN's avatar
        ValtteriN
        Icon for Community Champion rankCommunity Champion

        Hi,

        That's great! I would be good if you post your solution to this dicussion and mark it as a solution so that people will find the answer easier in the future.