Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
PatricioM
Contributor
Contributor

AGGR in set analysis

Hello everyone,

I am new in the forum and I was hoping I could find the answer I need for the KPI am working on. Its a calculation that need to have certain conditions. I am using the Aggr function in this calculation:

Avg(AGGR(
(Max(KM_OT)-Min(KM_OT))
/
(Max([Fecha OT])-Min([Fecha OT]))
*365,[Patente Vehículo]))

It works fine but I need to condition it with the following:

Min([KM_OT])>1000 and MAX([KM_OT])<200000 and (Max(KM_OT)-Min(KM_OT))>0

I am not being able to add these conditions as a set analysis, can you help me please?
Thank you

PM

Labels (1)
1 Solution

Accepted Solutions
Saravanan_Desingh

You can try with IF.

Avg(AGGR(If(Min([KM_OT])>1000 and MAX([KM_OT])<200000 and (Max(KM_OT)-Min(KM_OT))>0,
(Max(KM_OT)-Min(KM_OT))
/
(Max([Fecha OT])-Min([Fecha OT]))
*365),[Patente Vehículo]))

View solution in original post

3 Replies
Saravanan_Desingh

You can try with IF.

Avg(AGGR(If(Min([KM_OT])>1000 and MAX([KM_OT])<200000 and (Max(KM_OT)-Min(KM_OT))>0,
(Max(KM_OT)-Min(KM_OT))
/
(Max([Fecha OT])-Min([Fecha OT]))
*365),[Patente Vehículo]))
PatricioM
Contributor
Contributor
Author

Thank you! It works great, I was doing it the wrong way.

Regards,

PM

Saravanan_Desingh

you welcome