Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

sum added with another sum

I need to create an expression as follows:

sum (if ((sum (VALOR_X) / SUM (VALOR_Y)) * 100 <25, QTY).

It does not give error in syntax, but does not return the information.

How can I do this?

Can anyone help me?

Tags (1)
5 Replies
swuehl
Not applicable

Re: sum added with another sum

Just need to add a closing bracket at the end:

sum (if ( (sum (VALOR_X) / SUM (VALOR_Y)) * 100 <25, QTY))

rwunderlich
Not applicable

Re: sum added with another sum

Stefan, Isn't this a nested aggregation -- that requires an aggr()?

-Rob

swuehl
Not applicable

Re: sum added with another sum

Oh, yes!

Must have been blinded ...

Dozetech, where / in which context are you using this expression? As Rob correctly said, you need to use advanced aggregation to be able to embed an aggregation function linke sum() into  another aggregation function.

Not applicable

Re: sum added with another sum

Good Morning

I do a grouping as a percent range. Example: expense / Billing is less than 25% then sum amount.

I am unable to use the aggr ().

sum (if (aggr((sum (VALOR_X) / SUM (VALOR_Y)) * 100 <25), QTD)).

swuehl
Not applicable

Re: sum added with another sum

Expense / billing per which dimension?

You would need to add these dimension(s) as dimensions to the aggr() function, like

sum( aggr( if( sum(VALOR_X) / sum(VALOR_Y) < 0.25, QTD), Dim1, Dim2, ...))

Replace Dim1, Dim2, ... with the dimensions you need to group by your percentage calculation.

(And either take care that QTD has a single value per these dimensions, or aggregate QTD, too.)