Forum Discussion

BenediktW's avatar
BenediktW
Advocate I
2 years ago
Solved

Visual calculation: running sum - sorting issue

Hello together,

 

I ve tried to utilize the new visual calculations to calculate running sums (cumulative percentage sales per customers as running totals).

 

Anyhow, I have the problem that the running sum gets calculated based on the alphabetical order of the category. Not on the sales volume (how I want it to be), on which the table is sorted. Is there any solution for this?

 

Thank you very much!

 

On the "Anteil_am_Gesamtumsatz" you can see the correct order. Anyhow the running sum is not calculating based on the sorted order but on the alphabetical order of my category. 

  • lbendlin 

     

    Finally I found a solution without runningsum but with visual calc, which is working properly:

    FORMAT(SUMX( WINDOW(1, ABS, 0 ,REL, ALLSELECTED([Customer, ],  [Sales]), ORDERBY([Sales], DESC
    )), [Share total Sales]) , "Percent")

20 Replies

  • lbendlin 

     

    Finally I found a solution without runningsum but with visual calc, which is working properly:

    FORMAT(SUMX( WINDOW(1, ABS, 0 ,REL, ALLSELECTED([Customer, ],  [Sales]), ORDERBY([Sales], DESC
    )), [Share total Sales]) , "Percent")
    • AnneKeli's avatar
      AnneKeli
      Regular Visitor

      FINALLY!! THANK YOU!!! I have been searching for HOURS for this solution. I cannot believe it's this complex to change the sort order. THANK YOU, THANK YOU, THANK YOU

      • jeroenterheerdt's avatar
        jeroenterheerdt
        Microsoft Employee

        We want to change this and are working through options here. What would you like to have seen?

    • jeroenterheerdt's avatar
      jeroenterheerdt
      Microsoft Employee

      you can now do this with just runningsum (and without format): RUNNINGSUM([Sales], ORDERBY([Sales], DESC)). Then format the visual calculation using the data formatting option.

    • jeroenterheerdt's avatar
      jeroenterheerdt
      Microsoft Employee

      Since July, you can do the same using just RUNNINGSUM with the OrderBy parameter

    • BenediktW's avatar
      BenediktW
      Advocate I

      That is the formular for running sum

       

      My visual is sorted like this (based on Sales): 

      However, as soon as I enter the visual calculation area, it automatically ignores the sorting of the table and just takes the alphabetical order of my category (Customer): 

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Is there a way to have the visual calculation respond to the sort order for any column of the table? 

     

    Say I have a percent and cumulative percent, and I want that running tally to add up based on when I sort by column A or column B. Like it will dynamically respond to different sorting.

    • jeroenterheerdt's avatar
      jeroenterheerdt
      Microsoft Employee

      no, right now, just like with a window function you dicate the exact sort order. We have not gotten around to making this responsive to however the visual is sorted.