Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Acumulative bar chart based on filtered values (QlikSense)

Dear all,

Initially, I have a bar chart displaying the Sales (measure) per Country (dimension) in 2016 and the following two filters:

* Week: it contains number from 1 to 52 (referring the number of weeks of 2016).

* Period: it's a new field created in the data load editor. It can be equal to "Weekly" or "YTD".

Each of them can take only value at a time. Obviously, the data displayed by the bar chart changes every time we select a different week.

If Period is equal to "Weekly", I want to display the Sales per Country for the selected week. This works! Additionally, if Period is equal to "YTD", I would like to display the acumulative Sales (from first week to the selected week) per Country. Unfortunately, I'm having problems with the second part (Period equal to 'YTD').

Please find below the code for the measure of the bar chart typed up to the moment. I think the issue might be in the red highlighted part.

IF([Period] = 'YTD', RangeSum(above(Sum([Sales]),0,[Week])), Sum([Sales])

Thank you very much in advance. I would really appreciate if anyone could help me solve this issue.

Best regards,

Gonzalo

3 Replies
OmarBenSalem

maybe:

IF([Period] = 'YTD', RangeSum(above(Sum([Sales]),0,Rowno())), Sum([Sales])

Anonymous
Not applicable
Author

Dear Omar,

Thank you very much for your reply. Unfortunately, I does not work. If I use the code you provided me, it displays Sales, accumulated based on the Country (dimension of the bar chart) but not based on Week (added filter).

Best regards,

Gonzalo

OmarBenSalem

if u have a date field; you should create a measure YTD based on that date field:

please refer to this thread  which I tried to explain step by step how to create such time measures:

YTD, MTD issue