Forum Discussion

PowerBI__newbie's avatar
PowerBI__newbie
Frequent Visitor
2 years ago

Dynamic re-ordering by user

Hello, could you please help: how does one create a visual where users will be able to re-order items arbitrarily?

My data structure is:

NameAge
Anne-- some value --
Ben-- some value --
Charlie-- some value --
Dora-- some value --


After slicing, the user ends up with Anne and Charlie, with the default sorting 

 AnneCharlie
Age-- some value ---- some value --

 

The user would like to re-order the table arbitrarily, ie not based on any data.  For example, to end up with 

 CharlieAnne
Age-- some value ---- some value --


This seem to require inputting some (sorting) values that PowerBI can then sort by.

is there a way of achieving this?  

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, PowerBI__newbie 

    You can use the following method to sort by custom serial number. I created the following sample data:

    First, I copied Education, which I used as a sort:

    I'm creating a new Serial number column using the following DAX expression:

    Serial number =
    SWITCH (
        [Education],
        "elementary school", 2,
        "university", 1,
        "secondary school", 3
    )

    Click sort by column>>select Serial number column:

    Below is a comparison chart, the table on the left is the default sorting, and the table on the right is the custom sorting results:

    In addition, you can click below to learn more ways to customize the sorting. I've provided the PBIX file for this time below, and it would be great if it would help you.

    Sort a Column with a Custom Order in Power BI - RADACAD

    Custom sort / reorder rows & columns in Power BI - Inforiver

     

     

    How to Get Your Question Answered Quickly

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

    Best Regards

    Jianpeng Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Thank you!
    I have tried sorting by another column, and it's not what I need, unfortunately.

    The number of items is many hundreds; a particular user is likely to filter them down to 5-10.  There's no pre-determined way of ordering them.  To put it differently, a user goes through a fairly complex process when deciding how to order the items, and ultimately the ordering must remain a user's decision.

    That Inforiver video looks exactly like what I am trying to achieve ;o)

    Alternatively, if you have seen ordering columns in a Sharepoint view setup, something similar could work.

    I guess the other option is good old Excel...

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi, PowerBI__newbie 

      Thank you very much for your reply. In the default table visual, you can only customize the sorting by other columns or measures. You can follow these steps to take the visual you need:

      Hope the above can be helpful to you.

       

       

       

      How to Get Your Question Answered Quickly

      If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

      Best Regards

      Jianpeng Li

      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

       

       

       

       

       

       

       

      • PowerBI__newbie's avatar
        PowerBI__newbie
        Frequent Visitor

        Thank you!  I am trying to stick to standard PowerBI, though.

        One option I am exploring is:
        - creating multiple tables for Name, eg Rank_1_Name, Rank_2_Name, etc.
        - creating a separate Age measure for each Rank_X_Name
        - adding a slicer for each Rank_1_Name, Rank_2_Name, etc
        - using a multi-row card to bring in Age

        However, in reality I have around 15 columns in the original table that I need to show (as rows).  With 10 slicers, that means creating 150 measures... a nightmare to maintain! :o(

        is there perhaps a more efficient way of achieving this?

        In matrix terms, I simply need to join transposed copies of the original data filtered on Name being equal to first-ranked, second-ranked, etc values.  Don't know how to achieve this in PowerBI, though!