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

Nested aggregation error

Dear all,

I am getting the error "nested aggregation not allowed" for the following expression...

RANGESUM(ABOVE(SUM({$<[CALENDARIO.Anno]= {$(=Year(Today()))}>} TOTALE_VOCE-(sum({$<[CALENDARIO.Anno]= {$(=Year(Today()))}>} COSTO_PAGHE))),0,RowNo()))/
(SUM({$<[CALENDARIO.Anno]= {$(=Year(Today()))}>} TOTALE_VOCE)-SUM({$<[CALENDARIO.Anno]= {$(=Year(Today()))}>} COSTO_PAGHE))

...my head is exploding 😫

Thanks for your support

Mauro

 

3 Replies
WiscoSippi
Creator
Creator

RANGESUM(ABOVE(SUM({$<[CALENDARIO.Anno]= {$(=Year(Today()))}>} TOTALE_VOCE-...

 

should be 

 

RANGESUM(ABOVE(SUM({$<[CALENDARIO.Anno]= {$(=Year(Today()))}>} TOTALE_VOCE)))-...

 

and each subsequent function needs its own RangeSum with Above & RowNo. RangeSum is an aggregation function therefor cannot have other aggregations nested inside.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” — Antoine de Saint-Exupéry
jonathandienst
Partner - Champion III
Partner - Champion III

>> RangeSum is an aggregation function therefor cannot have other aggregations nested inside.

Not true. RangeSum() is not an aggregation function. It merely sums its parameters, and Above() returns some values to sum.

The problem is a misplaced parenthesis. i think what you meant was:

 

RANGESUM(
	ABOVE(
		SUM({$<[CALENDARIO.Anno]= {$(=Year(Today()))}>} TOTALE_VOCE) - 
		SUM({$<[CALENDARIO.Anno]= {$(=Year(Today()))}>} COSTO_PAGHE)
	, 0, RowNo())
) 
/
(SUM({$<[CALENDARIO.Anno]= {$(=Year(Today()))}>} TOTALE_VOCE) - 
SUM({$<[CALENDARIO.Anno]= {$(=Year(Today()))}>} COSTO_PAGHE))

 

 

With complex expressions like this, save your head by laying them out like the above so that you can see what is going on. 

 

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
WiscoSippi
Creator
Creator

I did identify the missing parentheses in my solution. Sorry for the misinformation on RangeSum.
“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” — Antoine de Saint-Exupéry