Need a special offer?Find out if your project fits.
+

How to avoid runningtotal to reset

Answered
Randolph Kepplinger asked on December 8, 2020

Hi!
Few words to explain what I want to achieve on my chart. I want to visualize how the value of all managed assets has changed in years / months. The thing is, for a year users want to see values for the last available month but want an option to split the year to see how the values have changed monthly. There is no option to calculate the "last" month in calculated fields so we decided to take a different approach.
For a new asset, the original price is saved as the value. And every time the value changes, we just save the difference. This solution works perfectly for a year. The problem is, if more years are shown, runningtotalsofrow is reset when the year is broken down into months.
Example can be found here: http://jsfiddle.net/szrb8Lc1/23/
Is there an option to disable runningtotalsofrow reset? Or maybe there is a different way to build this chart?
Kind regards!

5 answers

Public
Milena Pechura Milena Pechura Flexmonster December 10, 2020

Hello, Randolph,
 
Thank you for posting to our forum.
 
Our team is currently working on your questions.
We will make sure to reach out to you as soon as possible.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster December 14, 2020

Hi, Randolph,
 
Thank you for describing the desired component behavior in detail and for providing the JSFiddle example and screenshots.
 
Our team would like to suggest a solution for both cases you mentioned. Please find it below.
 
To see values for the last available month, please add the last_month field, which has true/false values, to your dataset. This will allow you to filter the months by last month.
For the case with runningtotalsofrow and months, we suggest showing only months instead of the year/month/day hierarchy.
Please see the example we have prepared for you: http://jsfiddle.net/flexmonster/43cv5arq/.
 
Here are some explanations about the code in the sample:
We defined preprocessData function to add the year, month, and last_month fields to the original dataset. Please define your own logic to mark whether the month is last available. As an example, we specified that the last_month has value true if the month == 12.
 
To show only months on the x-axis, the month field is selected in the slice. To display only the last months, the months are filtered by the last_month == true using filter object:

"filter": {
"members": [
"last_month.[true]"
]
}

The runQuery API call is used to change the slice.
 
Please let us know if the suggested approach works for your case.
Looking forward to your response.
 
Kind regards,
Milena

Public
Randolph Kepplinger December 15, 2020

Hi Milena!
 
Thanks for you answer and for an example. I will try to adapt our data model and chart in next days.
 
Kind regards!
Randolph

Public
Milena Pechura Milena Pechura Flexmonster December 24, 2020

Hello, Randolph,
 
Hope you are doing well!
 
Our team was wondering whether the suggested approaches helped.
Have you achieved the desired charts' appearance?
 
We will be glad to hear your feedback.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster January 15, 2021

Hi, Randolph,
 
How are you?
 
We would like to kindly take an interest in whether our response helped.
Could you please let us know if our suggestions worked for your case?
 
Looking forward to hearing from you.
 
Best regards,
Milena

Please login or Register to Submit Answer