Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

Use of Groups in an Aggregation Function

Is ot possible to use groups in an expression with aggregated function?

Sample:

=(if(GetSelectedCount(PROYECTO)>1,
Sum( Aggr(Count({Grupo_3< AGRUPACION_LP = {'Ligeros'}>} ID_TRANSIT) * Only(POND_TOTAL), FECHAT, PROYECTO, DESCRIPCION))/
COUNT({Grupo_3<DUE = {'1'}>} Día),
if(IsNull(GetFieldSelections(PROYECTO)),
Sum( Aggr(Count({Grupo_3< AGRUPACION_LP = {'Ligeros'}>} ID_TRANSIT) * Only(POND_TOTAL), FECHAT, PROYECTO, DESCRIPCION))/
COUNT({Grupo_3<DUE = {'1'}>} Día),
Sum( Aggr(Count({Grupo_3< AGRUPACION_LP = {'Ligeros'}>} ID_TRANSIT) * Only(POND_PROY), FECHAT, PROYECTO, DESCRIPCION))/
COUNT({Grupo_3<DUE = {'1'}>} Día))))

 

I had already created the group_3 

Best

 

Tags (1)
2 Replies
Highlighted
Contributor II
Contributor II

Re: Use of Groups in an Aggregation Function

Just clarifying,

Instead of groups I wanted to say States, in other words, I have created two states named Grupo_3 and Grupo_4 , and I want to use them in the expressions but is not working, I wonder if th problem is that I'm using n aggregted function.

Hope I was clear enough

Best

Highlighted
Contributor II
Contributor II

Re: Use of Groups in an Aggregation Function

Well, I did it by myself hehe!

Here's the solution:

 

=(if(GetSelectedCount(PROYECTO)>1,
Sum({Grupo_2} Aggr(Count( {Grupo_2}ID_TRANSIT) * Only({Grupo_2}POND_TOTAL), FECHAT, PROYECTO, DESCRIPCION))/
COUNT({<DUE = {'1'}>} Día),
if(IsNull(GetFieldSelections(PROYECTO)),
Sum({Grupo_2} Aggr(Count({Grupo_2} ID_TRANSIT) * Only({Grupo_2}POND_TOTAL), FECHAT, PROYECTO, DESCRIPCION))/
COUNT({<DUE = {'1'}>} Día),
Sum({Grupo_2} Aggr(Count( {Grupo_2}ID_TRANSIT) * Only({Grupo_2}POND_PROY), FECHAT, PROYECTO, DESCRIPCION))/
COUNT({<DUE = {'1'}>} Día))))

Here's the result.-

alexdelagarza_0-1590192228527.png