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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Chart - Expression: Count and Accumulate when

Sample data below and sample app attached.

I'm trying to measure "Engaged Members" Per Month (& create a % change per month in a como chart but need to understand how I would create the counts first).

Metric:

Per month: Count member id and when member is still "Open" accumulate to the following month.

The below data should read

201607 = 10 (Memberid: 1-9 & 21)

201606 = 8 (Memberid: 13-19 & 21)

Total records below = 17

5 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached example.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

That's close, but for my chart my results are backwards. See below pic. The accumulation total should be larger througout time. I simply tried to sort ASC but that didn't work. I also tried to swap above with below and that didn't seem to work either. I do only want to visually see 6 values but calculate all. So, I added the if(rowNo()<=6

Any suggestions?

if(RowNo()<=6,
rangesum(
COUNT(ID),
sum(aggr(rangesum(above(COUNT({<ENROLLMENT_STATUS={'OPEN'},STARTDATE_YYYYMM>}ID), 1, RowNo(total))),STARTDATE_YYYYMM))
)
)

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Read the script. It explains how the months are sorted. If you want only the last six month then select those months or add a condition to the expression that selects those months. Something like this:

rangesum(

  COUNT({<START_Year_Month={'>=$(=max(START_Year_Month)-5)<=$(=max(START_Year_Month))'}>}Memberid),

  sum({<START_Year_Month={'>=$(=max(START_Year_Month)-5)<=$(=max(START_Year_Month))'}>}aggr(rangesum(above(COUNT({<Status={'OPEN'},START_Year_Month>}Memberid), 1, RowNo(total))),START_Year_Month))

)

Note, this won't work correctly if you pass a year border. 201605 - 5 = 201600 instead of 201512. What you need to do to fix that is to use a real date field instead of the ordinal numeric yearmonth field.


talk is cheap, supply exceeds demand
vinieme12
Champion III
Champion III

Try the attached

openMembers.JPG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

I'll try and work it out on my own and be more clear as to what I'm looking for becuase either I'm not following which is probable or we are not in synch.  Thanks!