Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qliky88
Creator
Creator

Simple KPI COUNTIF

Hi All, 

 

Apologies in advance if this is a basic question - but I want to create a KPI on my dashboard to count if products are <, = or > a certain age. The age is setup in my dataset as a calculated field (Date Authorised - Date Logged)

 

I have filters on the top of the dashboard, so not sure if I can use set analysis? My formula for the KPI is 

count(distinct(Age<10))

 

But the number returned does not correspond with the data in a straight table. Any help/ info on where I'm going wrong much appreciated

Labels (4)
2 Solutions

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

Hi 

you can do 

sum(aggr(if(Age<10,1,0),product))

View solution in original post

lironbaram
Partner - Master III
Partner - Master III

Hi

try this : 

sum(aggr(if(floor(max(Age))<10,1,0),product))

View solution in original post

5 Replies
lironbaram
Partner - Master III
Partner - Master III

Hi 

you can do 

sum(aggr(if(Age<10,1,0),product))

qliky88
Creator
Creator
Author

@lironbaram  thank you 🙂 I never knew you had to aggregate and then sum to countif in Qlik. Much appreciated ! 

 

qliky88
Creator
Creator
Author

Hey @lironbaram 

 

Apologies for this - looks like the formula is working but not counting all of the values that is corresponding in the straight table. 

 

KPI is reading 3, but there are 14 samples in the straight table below.

'Age' is a calculated field and I am using =floor(Age) in the straight table as age is timestamped. 

lironbaram
Partner - Master III
Partner - Master III

Hi

try this : 

sum(aggr(if(floor(max(Age))<10,1,0),product))

qliky88
Creator
Creator
Author

Many many thanks @lironbaram , would not have gotten that on my own!