Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
divya_anand
Creator III
Creator III

Accumulate Sum only until current month

Hi,

In the below screenshot, I have 2 expressions - the blue line is for the selected year ( in this case 2019 is selected) and the red line is for the previous year (selected year - 1). As you can see, in 2019 we have data only until current month, but the accumulation is done for until Dec. How can I show accumulation only until current month if the current year is selected? I have attached a sample QVW for reference.

Thank you.

Snap.PNG

Labels (4)
2 Solutions

Accepted Solutions
madhu_r
Partner - Contributor III
Partner - Contributor III

Hi,

Try this

In Expression for only(Year) give this expression: Rangesum(Above(Sum(Sales),0,Max(Month)))

 

Rangesum function.PNG

View solution in original post

sunny_talwar

You can also use these expression if there are no 0 sales for any particular month in the past

Year

=If(Sum(Sales) > 0, Rangesum(Above(Sum(Sales),0,RowNo())))

Previous Year

If(Sum({<Year={$(=Only(Year)-1)}>}Sales) > 0, Rangesum(Above(Sum({<Year={$(=Only(Year)-1)}>}Sales),0,RowNo())))

View solution in original post

3 Replies
madhu_r
Partner - Contributor III
Partner - Contributor III

Hi,

Try this

In Expression for only(Year) give this expression: Rangesum(Above(Sum(Sales),0,Max(Month)))

 

Rangesum function.PNG

adamgaox
Creator
Creator

Try this in the 2018 expression

Rangesum(Above(Sum({<Year={$(=Only(Year)-1)},Month = {$(=Concat(DISTINCT chr(39) & Month & Chr(39),','))}>}Sales),0,RowNo()))

sunny_talwar

You can also use these expression if there are no 0 sales for any particular month in the past

Year

=If(Sum(Sales) > 0, Rangesum(Above(Sum(Sales),0,RowNo())))

Previous Year

If(Sum({<Year={$(=Only(Year)-1)}>}Sales) > 0, Rangesum(Above(Sum({<Year={$(=Only(Year)-1)}>}Sales),0,RowNo())))