Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
11 months ago

Sort Axis on Waterfall Chart

I have a consultation

I've generated a waterfall chart in Power BI with the variables
CATEGORY: Mg 2025P & Mg 2025R
BREAKDOWN: Mg Serv, Mg Eq, C. Op and C. Com
Y-axis: Sum of Total



My chart works perfect but I'd like to sort my X-Axis, i.e. where CATEGORY and BREAKDOWN go. This, because every time I filter by month, it keeps CATEGORY sorted, but it sorts me BREAKDOWN by value and not by name.

I even rename the variables with a number before, but it keeps getting messy. There is some way to order it, I have tried:
- Creating tables with order, but they don't work because each variable has more than one match.
- Creating order measures within the same table where the waterfall variables are, but I generated a redundancy error.
- Renaming in Power Query (to put a number before, which it shouldn't be), but it didn't work

If someone can guide me if it is possible to do what I need, and if it is, it does not complicate me if I should make it with DAX measurement or code in Power Query. Of course, thanks to any possible help.

12 Replies

  • Syndicate_Admin It's difficult to be certain without full sample data to test but I believe what you would want to do in your case is to have a Sort By column for the CATEGORY column. This should be a numeric column that you would add in Power Query and there would be a 1:1 relationship between unique values in the CATEGORY column and this Sort By column. You should then be able to use the ellipses (...) in the Waterfall chart to change the sort axis to CATEGORY and then either ascending or descending as appropriate.

    • Syndicate_Admin's avatar
      Syndicate_Admin
      Administrator

      For the data, you need a PBIX file or what numbers they have, according to the months I am filtering???

      I had thought of something like that, looking for how to generate an order column in Power Query to sort, in my case BREAKDOWN (because CATEGORIES is correctly ordered), you guide me with my doubt.

      • GeraldGEmerick's avatar
        GeraldGEmerick
        Super User

        Syndicate_Admin Well, I think that the column would look something like the following. PQ only supports if then else statements so it is a bit messy but for a limited number of categories it should work. This would be entered into an Add Custom Column formula (without the = sign):

        =
        if [BREAKDOWN] = "Mg Serv" then 1 else 
        if [BREAKDOWN] = "Mg Eq" then 2 else 
        if [BREAKDOWN] = "C. Op" then 3 else
        if [BREAKDOWN] = "C. Com" then 4 else
        5

         

  • I'm trying to do the sorting by modifying the M code in Power Query but I'm not getting to the expected result. Someone who knows whether or not the BREAKDOWN variables can be sorted in a waterfall chart and that they remain fixed, regardless of the filters applied

  • You explain to me how the structure of that table I must create should be. I guess I should do this in Power Query, to indicate the order of this column (Breakdown) and keeping the order of Category

    • v-nmadadi-msft's avatar
      v-nmadadi-msft
      Community Support

      Hi Syndicate_Admin ,

      You can build this mapping table in Power Query (manually create a small table with those pairs). Once you have it:

      1. Load it into the model.

      2. If it’s a separate mapping table, create a relationship from BREAKDOWN in your fact table to BREAKDOWN in this mapping table, then add the SortOrder column to your fact table via a merge.

      3. In the Data view, select your BREAKDOWN column, then set Column Tools → Sort by Column → SortOrder.

      This way, whenever you use BREAKDOWN in the Waterfall chart, it will always respect the custom order you defined, regardless of which CATEGORY or filter you apply.

      I hope this information helps. Please do let us know if you have any further queries.
      Thank you


  • Hi Syndicate_Admin ,

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.


    Thank you.

  • Comment that I still have the problem of not being able to sort my waterfall chart in Power BI.
    I have tried a measure (that combines CATEGORY and BREAKDOWN), which allows me to sort but I lose the waterfall chart structure, I am left with a normal waterfall with values that vary from start to finish, without being able to customize the first bar (first and last bar must be blue)
    If I keep putting together my Category Bars and Breakdown Bars structure, I can't sort the breakdown bars, to leave them fixed and they are automatically sorted by value (when I need them to be sorted by name).
    If I create a clustered column chart (to simulate a waterfall) I can give the order of the bars and use the colors as I want, but the size of the bars is too small and I can't customize them.

    There is some way to manage to order a waterfall chart with these (fixed) variables:
    Mg 2025P
    Mg Serv
    Mg Eq
    C. Op VP
    C. Eating
    Mg Real

    PS: I can't use additional add-ons, any help that helps me with my problem, I'll be very grateful.

  • Hi Syndicate_Admin ,
    If the provided suggestions are not working for your scenatio and If the required feature is important for your functionality, Please consider sharing your suggestion in the Power BI Ideas forum
    Fabric Ideas - Microsoft Fabric Community
    where the product team actively monitors user feedback. Ideas with strong community support are more likely to be considered for future implementation. Posting there helps ensure your request reaches the right audience and contributes to shaping the product roadmap.

    Could you please confirm if you've submitted this as an idea in the Ideas Forum? If so, sharing the link here would be helpful for other community members who may have similar feedback.

    Thank you for being part of the Microsoft Fabric Community.