Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
sunil-kumar5
Creator II
Creator II

Active Count and Expired Count

Hello All,

I have a below table where I need to count distinct license number for active and expired.

add 60 days in amcduedate and software type should be M only not C. After adding the 60 days formula will be like if (amcduedate < today(), Expired,Active).

I am not able to add software type in my script. Please help

Answer will be : Active -6 and Expired is 3

Partnernamelicensenumbersoftwaretypeinstallationdateamcduedate
A1656MJan-20Jan-21
B1654CFeb-18Feb-19
C1590MMar-20Mar-21
D1361MFeb-19Feb-20
A1234MFeb-20Feb-21
B1571CApr-20Apr-21
C1981MApr-20Apr-21
D1636CMar-20Mar-21
D1602CFeb-20Feb-21
A1921MJan-20Jan-21
B1725MFeb-19Feb-20
B1732MMar-20Mar-21
C1706CMar-20Mar-21
D1996MMar-18Mar-20

 

1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

A couple of different ways to approach this, depending on what you are presenting.  If Expired and Active are in 2 different KPIs, you could use:

Expired:

count({$<softwaretype={'M'},licensenumber={"=(amcduedate+60<='$(=Date(Today()))')"}>}Distinct licensenumber)

Active

count({$<softwaretype={'M'},licensenumber={"=(amcduedate+60>'$(=Date(Today()))')"}>}Distinct licensenumber)

 

If you want this in a table, you could use this for your dimension:

=if(amcduedate+60<='$(=Date(Today()))','Expired','Active')

and this for your measure:

count({$<softwaretype={'M'}>}Distinct licensenumber)

 

View solution in original post

2 Replies
GaryGiles
Specialist
Specialist

A couple of different ways to approach this, depending on what you are presenting.  If Expired and Active are in 2 different KPIs, you could use:

Expired:

count({$<softwaretype={'M'},licensenumber={"=(amcduedate+60<='$(=Date(Today()))')"}>}Distinct licensenumber)

Active

count({$<softwaretype={'M'},licensenumber={"=(amcduedate+60>'$(=Date(Today()))')"}>}Distinct licensenumber)

 

If you want this in a table, you could use this for your dimension:

=if(amcduedate+60<='$(=Date(Today()))','Expired','Active')

and this for your measure:

count({$<softwaretype={'M'}>}Distinct licensenumber)

 

sunil-kumar5
Creator II
Creator II
Author

Hi Gary 

Thanks for providing the solution.

Can you please solve one more situation?

I have to count the partners name who sale >=1 license in last three months.

Please advise.

Thanks