Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for
Did you mean:
Creator

## Chart expression help

Hi Experts,

stalwar1

I have a combo chart with 2 expression.

Expression- 1:- Sum of Sales Units

Expression -2:- Sum of Sales Units from the current month to rolling 12 months. For eg; For Jan'18, sales units is 10 units which is represented in the bar. For the same month Jan'18, the line graph should show total sales units as 2902 units (which is the sum from Jan'18 to Dec'18). For Feb the expression 2 should show from Feb'18 to Jan'18 which would be 3125 units and so on.

The trend line should always be static for 12 months and should not change regardless of selection in month which I will have as a saperate list box.

For eg- The current trend line does the sum of sales for 12 months when there are no filters applied. If I want to view just 4 months of data the trend line should still show the same 12 months sum and not change for just 4 months.

I need help with the expression 2 please.

1 Solution

Accepted Solutions
MVP

10 Replies
Master II

Maybe this:

=RangeSum(Below(Sum({1}[Sales Units]), 0, 12))

hope this helps

MVP

Or one of theses

=RangeSum(Below(Sum({<Date>}[Sales Units]), 0, 12)) * Avg(1)

or

=RangeSum(Below(Sum({<Date>}[Sales Units]), 0, 12))

Top chart uses the 1st expression where the accumulation is based on 12 months, but it show only the selected Month's 12 month accumulation. Whereas the second expression shows everything regardless of the selection in Date field.

Creator
Author

HI Frank,

Have one more request on this outcome.. For Eg ; When I select 3 months in Month List box, I need to see the Line only for 3 months as well... instead of seeing it for all the months..  How do we get that ?

MVP

Try this

=RangeSum(Below(Sum({<Date>}[Sales Units]), 0, 12)) * Avg(1)

Creator
Author

Looks good Sunny.

But have an issue.. when I select 3 months.. I see other months as blanks as well apart from the ones that I have selected.. How to overcome this ?

I have used this formulae..

=RangeSum(Below(Sum({<Date>}[Sales Units]), 0, 12)) * Avg(1)

MVP

Can you check 'Suppress Zero Values' on the presentation tab?

Creator
Author

Yes.. it is checked in presentation tab.. And in dimensions aswell..

MVP