Forum Discussion

SDigital007's avatar
SDigital007
New Member
7 years ago
Solved

Multi-tiered Custom Sort as in Excel

Re-posting since the original request was marked complete even though it wasn't.

 

I use Power BI to create invoices for our clients. I need the ability to sort my entire table at 3 different levels - using 3 columns as in Excel: Column 1: Customer Id from A to Z, Column 2: Products by Supplier A-Z, Column 6: Prices from high to low. Currently Power BI only allows sorting at one level at a time. Sorting at the second level scrambles the 1st, undoing the order of customer IDs.

What I am looking for is a way to sort by level: 1st customer ID, then for each customer ID, sort by product type, then for each product type, sort by price. The end goal is to create line items for customer invoices.

  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi there.

     

    I myself have not familiarized myself with multi-level sorting in Power BI, but I believe you can do it.

     

    In the Power Query editor, click the drop down next to the first column you want to sort. You can then repeat this for the second and third level columns.

     

    Your applied step will look something like this:

    = Table.Sort(#"Multi-level Sort",{{"Customer ID", Order.Ascending}, {"Products by Supplier", Order.Ascending}, {"Prices", Order.Ascending}})

    Hope this helps!

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi there.

     

    I myself have not familiarized myself with multi-level sorting in Power BI, but I believe you can do it.

     

    In the Power Query editor, click the drop down next to the first column you want to sort. You can then repeat this for the second and third level columns.

     

    Your applied step will look something like this:

    = Table.Sort(#"Multi-level Sort",{{"Customer ID", Order.Ascending}, {"Products by Supplier", Order.Ascending}, {"Prices", Order.Ascending}})

    Hope this helps!