Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Specialist
Specialist

How to write the expression in KPI

Hello All,

I need to count number of  NOD whose NOD are <20 & >30 in two different KPI's

From the below image 

Capture.PNG

KPI 1:<20 NOD  : 5,  

KPI 2: >30 NOD  : 2

Dimension : Store, store Detail, Brand

NOD Expression : 

(

aggr(sum(mat_count),Store,store Detail,Brand)
/
alt(
avg({<Year,Month,Date={">=$(=date(monthstart(addmonths(max(Date),-5)),'DD-MM-YYYY'))<=$(=date(((max(Date))),'DD-MM-YYYY'))"}>}
aggr(
Sum({<Year,Month,Date={">=$(=date(monthstart(addmonths(max(Date),-5)),'DD-MM-YYYY'))<=$(=date(((max(Date))),'DD-MM-YYYY'))"}>}bil_count)
,Store,store Detail,Brand)
),0)


) *30

 

Thanks

 

 

2 Replies
Highlighted
Specialist
Specialist

I tried some thing like below ,but it is showing 0 Value

sum(aggr(
if(
(
(

aggr(sum(mat_count),Store,[stock Details],Brand)
/
alt(
avg({<Year,Month,Date={">=$(=date(monthstart(addmonths(max(Date),-5)),'DD-MM-YYYY'))<=$(=date(((max(Date))),'DD-MM-YYYY'))"}>}
aggr(
Sum({<Year,Month,Date={">=$(=date(monthstart(addmonths(max(Date),-5)),'DD-MM-YYYY'))<=$(=date(((max(Date))),'DD-MM-YYYY'))"}>}billing_count)
,Store,[stock Details],Brand)
),0)


) *30
)<20,1,0),Store,[stock Details],Brand))

 

What am i missing in above expression

Highlighted
Digital Support
Digital Support

Have a look at the following Design Blog post on AGGR and Set Analysis, hopefully that may have what you need to get things working properly.

https://community.qlik.com/t5/Qlik-Design-Blog/Set-Analysis-in-the-Aggr-function/ba-p/1463822

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.