Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
LHBR
Contributor II
Contributor II

Cumulative YTD Sum in Bar Chart using "Month" filter selection - Not working!

Hey, guys!

Long time lurker and you guys saved me countless times before. This time, however, I am having trouble just reading similar posts and can't find an answer. 

I have the following example table: 

[Revenue]:
LOAD * INLINE [
Year;Month;Revenue
2017;01;100
2017;02;150
2017;03;50
2018;01;1000
2018;02;500
](delimiter is ';');

I made a Bar Chart using "Year" as a dimension. So far, the chart shows me two bars, one for 2017 and another one for 2018, totaling 300 for 2017 and 1500 for 2018. So far, so good! Pic for reference:

YTD_Unselected.png

 

The problem is that I use Month as a button filter, and can't make it work as intended, which is the bar chart showing the Cumulative sum up to the selected month for both years displayed. It only displays the results for the selected month.

YTD_Month_Selected.png

What am I doing wrong? 

Can you guys help me? Thanks in advance!

 

Labels (2)
1 Solution

Accepted Solutions
dilipranjith
Partner
Partner

It is working as intended as far as qlik is concerned. by default it shows only the month selected.

To show what you need you need set analysis. try below

create variable vMonth  as  =Max(Month)

your expression

Sum({<Month={"<= $(vMonth)"}>}Revenue)

// basically month less than or equal to max of possible months so when 2 is selected <=2

View solution in original post

4 Replies
dilipranjith
Partner
Partner

It is working as intended as far as qlik is concerned. by default it shows only the month selected.

To show what you need you need set analysis. try below

create variable vMonth  as  =Max(Month)

your expression

Sum({<Month={"<= $(vMonth)"}>}Revenue)

// basically month less than or equal to max of possible months so when 2 is selected <=2

View solution in original post

LHBR
Contributor II
Contributor II
Author

Thank you very much, Dilipranjith!

I always get confused with the definition and usage of set analysis!

It worked perfectly!
dilipranjith
Partner
Partner

not a problem
you can also make it as below
Sum({<Month={"<= $(=Max(Month))"}>}Revenue)

i personally prefer the variable approach
Channa
Specialist III
Specialist III

you can try using Date >= yearstart (today()) and <= today()

Channa