Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
kunkumnaveen
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
kunkumnaveen
Specialist
Specialist
Author

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

Brett_Bleess
Support (Former)
Support (Former)

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.