Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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

2 Solutions

Accepted Solutions
Highlighted
Partner
Partner

Hi 

you can do 

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

View solution in original post

Highlighted
Partner
Partner

Hi

try this : 

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

View solution in original post

5 Replies
Highlighted
Partner
Partner

Hi 

you can do 

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

View solution in original post

Highlighted
Creator
Creator

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

 

Highlighted
Creator
Creator

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. 

Highlighted
Partner
Partner

Hi

try this : 

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

View solution in original post

Highlighted
Creator
Creator

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