Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
sunitha_chellaiah
Partner - Creator
Partner - Creator

Cumulative Sum of Current and Previous Year

Hi All,

My requirement is to show current year and previous year cumulative sum in single bar chart with x-axis being current year.

Current year cumulative sum is working fine. But, I am unable to plot Previous Year cumulative sum.

Kindly find attached herewith the screenshot.

sunitha_chellai_0-1590497705638.png

I have used below mentioned expressions:

Dimension : Unlink_Date

Measures:

_ETBR : 

Sum({<Unlink_Date={">=$(vMinDate_1)<=$(vMaxDate_1)"}>}
if( link_Date = Unlink_Date and [Txn Type]='$(=Maxstring(_ETBR))',[Txn Count]))

Cumulative-CY:

RangeSum(Above(Sum({<Unlink_Date={">=$(vMinDate_1)<=$(vMaxDate_1)"}>}
if( link_Date = Unlink_Date and [Txn Type]='$(=Maxstring(_ETBR))',[Txn Count])), 0, RowNo()))

 where vMinDate_1  : Date(Min(link_Date),'DD-MM-YYYY')

               vMaxDate_1 : Date(Max(link_Date),'DD-MM-YYYY')

 

For Previous Year Cumulative Sum , I am using below mentioned expression , but it's not working

Sum({<Unlink_Date={">=$(vMinLYTD)<=$(vMaxLYTD)"}>}
if( link_Date = Unlink_Date and [Txn Type]='$(=Maxstring(_ETBR))',[Txn Count]))

where vMinLYTD:  Date(Addyears(Min(link_Date),-1),'DD-MM-YYYY')

             vMaxLYTD: Date(Addyears(Max(link_Date),-1),'DD-MM-YYYY')

Note : Only current year need to show in x-axis.

 

Thanks

 

2 Replies
martinpohl
Partner - Master
Partner - Master

you x-axis is 01-04-2020 so there is no value to count for in 2019

Why don't you use 01-04 as dimension and

sum([tnx Count]

and 

sum({<Year={$(=max(Year)-1)}>}[tnx Count]

instead and use modificator accumulation 

sunitha_chellaiah
Partner - Creator
Partner - Creator
Author

We are using oldest version in our server. So, modifier accumulation is not possible