Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
juagarti
Contributor III
Contributor III

ERROR in expresion Nested aggregtion not allowed

Hello,

I'm trying to make an expression in a text block. The expression is:

=SUM(if(TIPO_ALMACENAMIENTO='MAI' AND MES=MaxString(MES), INSTALADO))

the problem is in the expresion MES=MaxString(MES), if I put MES='dic.' there is any problems but when I use the expresion MaxString(MES) the text block, it show me the error

ERROR in expresion Nested aggregtion not allowed

the function MaxString(MES) throw me dic. but I need 'dic.'

How can I solve this?

I want to put the max month of the year that I have information

Thank you very much!

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try:

=SUM(if(TIPO_ALMACENAMIENTO='MAI' AND MES='$(=MaxString(MES))', INSTALADO))

View solution in original post

7 Replies
Not applicable

Not sure if I understand this correctly but try this:

Mes=Month(Max(Date))

JonnyPoole
Employee
Employee

What context do you need to evaluate 'Maxstring(MES)' ? At the application level or row by row ?

If its just once at the application level, you could try precalculating that value outside the expression using a variable. Create a variable vMaxMes with an expression:  '=MaxString(MES)' . Be sure to keep the leading '=' sign with the expression so that is evaluates BEFORE the other expression .

Then reference the precalculated variable as follows.

SUM(if(TIPO_ALMACENAMIENTO='MAI' AND MES=$(vMaxMes), INSTALADO))


This approach won't work if you have to calculate MaxMes differently on a chart row by row basis, becuase it will evaluate to just one value for the whole app.

juagarti
Contributor III
Contributor III
Author

this throw me dic. but I need 'dic.'

juagarti
Contributor III
Contributor III
Author

If i put mes =dic. qlik throw me ERROR in expresion Nested aggregtion not allowed but if I put mes='dic.' everything run ok

juagarti
Contributor III
Contributor III
Author

I need to evaluate in a chart but I'm proving this firts in a text block to know it's run ok or not

tresesco
MVP
MVP

Try:

=SUM(if(TIPO_ALMACENAMIENTO='MAI' AND MES='$(=MaxString(MES))', INSTALADO))

Kushal_Chawda

may be

=sum(aggr(if(TIPO_ALMACENAMIENTO='MAI' AND MES=MaxString(MES), INSTALADO), ID))