Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Slicer Ordering

I am looking for a suggestion how I can create a preferred order within a slicer, instead of alphabetical.   Any suggestions on how to do this simply and elegantly?
  • pschommer's avatar
    pschommer
    9 years ago

    I have created a simple example *.pbix file HERE. The data are from an Excel file found HERE.

     

    tblSort contains the fruit in the order I want to see them (Strawberry first). As explained in the answer, we need to create a relationship between the tables. Along the left side of the PBI Desktop, select the third button (Manage Relationships). Create the relationship by dragging the SortValue field on tblSort (fruit name) to the FruitName field on tblFruit (also fruit name).

     

    Now go back to the report canvas. The stacked column chart is pretty straighforward using values from tblFruit. The slicer, however, is sourced from the SortValue field on tblSort, not from the FruitName field on tblFruit. (Both would work, but only one would allow you to order the values.) Even after setting up the slicer, there is still the task of forcing a different sort order. This is done by highlighting the SortValue field in the Fields area on the far right of the desktop canvas, going to the Modeling tab, clicking Sort by Column from the ribbon, then selecting SortOrder. This is the numeric representation of the desired order of the fruit values.

     

    Clicking different slicer values works just like using FruitName from tblFruit as a slicer value, but the values are in the order I want.

     

    I suggest starting from a new tab and trying to recreate the scenario, or starting over with just the sample data. When that is working as expected, go back to your own dataset and give it a try. Good luck.