1
votes

I have had to create a cumulative sum group and a remove_zero group for my project. The issue arises when I combine them and filters on another dimension. It looks like the filter is not taken into account in my cumulative sum fake group.

I have put everything into this jsFiddle.

When filtering on age by clicking on the barchart on top (only the 1w will do something), both line charts at the bottom should have the same date span if I understand correctly since they're using the same dimension. But that does not happen. The top one does not rescale at all while the bottom one does.

enter image description here

The only difference between the 2 line graphs (that I can see) is in the group definition :

  • top one :.group(remove_zero_values(cumulSumGroup(groups.date.TOTAL_PNL)))
  • bottom one :.group(remove_zero_values(groups.date.TOTAL_DELTA))

My question is : how do I make sure that the top line graph also filters on dates when I click on the top bar chart ?

1

1 Answers

1
votes

If you are combining cumulative sum with filtering zeros, you will want to filter the zeros first:

.group(cumulSumGroup(remove_zero_values(groups.date.TOTAL_PNL)))

Otherwise, each bin will inherit a value from the last one, and very few of them will remain zero.

Fork of your fiddle.