I am using 100% Stacked Bar chart and am unable to sort how I want.
Here is a sample dataset.
person | Item | order bought | rank preferred | Spend |
---|---|---|---|---|
1 | Bike | 1 | 1 | 600 |
1 | Watch | 2 | 3 | 250 |
1 | Tickets | 3 | 2 | 1000 |
2 | Bike | 2 | 3 | 100 |
2 | Watch | 3 | 2 | 400 |
2 | Tickets | 1 | 1 | 650 |
There are a couple of issues: 1). The person order is 2,1 and I want it sorted 1,2 (less important). 2). The more important place I'm stuck is trying to get the items in the bar to sort by either the order they were bought (order bought) or where they ranked their preference (rank preferred).
When I click on "Item" and try "Sort by Column", it gives me this error (there can't be more than one value in rank preferred for the same value in item):
I think I know what it's saying - that because the Item has different ranks associated with it, it can't sort, but the ranks are distinct for each person/item combination, so not sure why it doesn't work.
How can I get it to sort the items by rank or order bought?
Welcome to the wonderful world of sorting in PBI. For the first problem to sort person 1 to 2, click the person column and change the datatype to text. This will also bring your bars closer together.
For the second problem, you have multiple values so PBI doesn't know how to sort it. e.g. Bike has rank preferred of 1 for person 1 but 3 if the person is 2. It needs to be unique in order to sort the column.