Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
Qlik Connect 2025! Where innovative solutions turn your data visions into reality: REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
rahulsingh12
Contributor III
Contributor III

Last 2 Month Count

Hi,

I have created an expression in which if we select a month it counts the unique outlet from Current and last month.

But if we add the month in the table it starts showing the unique outlet for individual month.

e.g

State     #Count

AP               85

State Month     #Count

AP      1               67

AP      2               100

I want the output to be showing unique outlet for the current month and last month for each month not individual unique outlet for each month.

Thus if for 3 and 2 we have 100 outlet

2 and 1 month we have 85 unique outlet then output should be like

State Month     #Count

AP      2               85

AP      3               100

10 Replies
sunny_talwar

Try this

=RangeSum(ABove(

Sum({<Month>}Aggr(If(Only({<Month>}OutletCode) = Above(Only({<Month>}OutletCode)), Null(),

Count({<Month>} OutletCode)), OutletCode, (Month, (NUMERIC)))), 0, RowNo())) * Avg({<Month={">=$(=$(vMaxMonthOneLess))<=$(=$(vMaxMonth))"}>} 1)