Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
LINKEDIN LIVE: Democratizing data to enhance customer-centricity. JULY 29TH REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
alexdelagarza
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

 

1 Solution

Accepted Solutions
alexdelagarza
Contributor II
Contributor II
Author

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

 

 

View solution in original post

2 Replies
alexdelagarza
Contributor II
Contributor II
Author

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

alexdelagarza
Contributor II
Contributor II
Author

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

 

 

View solution in original post