Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
My data has fields Year (2016,2017,2018) and ID. I want to create a bar chart with dimension: Year, measure: COUNT(ID). The thing is, I want the accumulated result. For example, if I select Year=2016, it will show me count of ID in 2016; if I select Year=2017, it will show me count of ID in 2016 & 2017, and so on.
How should I create the function?
Thanks for help!
Oh you want a cumulative sum in a single bar... try this
RangeSum(Above(Count({<Year>}ID), 0, RowNo())) * Avg(1)
May be try this expression:
Count({<Year = {"$(='<=' & Max(Year))"}>}ID)
Hi Sunny,
Thanks for helping! I gave it a go, but it didn't work. By using Count({<Year = {"$(='<=' & Max(Year))"}>}ID), if I choose 2017, the bar chart will show me two bars: 2016 & 2017, separately.
Oh you want a cumulative sum in a single bar... try this
RangeSum(Above(Count({<Year>}ID), 0, RowNo())) * Avg(1)
It works! Thank you so much!
Hi Sunny, may I have one more question for you?
What is the use of Avg(1)?
Since I am ignoring the selection of Year in the main expression... it will not filter down to just the required year and will show all the years. Avg(1) is used to remove all the unselected year. Avg(1) = 1 for selected year and equals 0 for unselected years
Got it! Thank you Sunny!