Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

jaryszek2
Contributor

Accumulative sums - conditional in aggregation

Hi,

the function i have from

Accumulative Sums

sum( aggr( rangesum( above( sum(Sales),0,12) ),Month, Store))

I have 3 different listobox: Black Store, White Store, Red Store with values attached to them.

I want to have sum( aggr( rangesum( above( sum(Sales),0,12) ),Month, Black)) when i select one value from Black Store listbox.

i tried:

sum( aggr( rangesum( above( sum(Sales),0,12) ),Month,

if(getselectedcount(red)>0,red,

   if(getselectedcount(white)>0,white,

     if(getselectedcount(black)>0,black)) but it doesnt work.


So my question is how can i put only names of columns to aggregation funtion?


Thank You in advance,

Jacek Antek


1 Solution

Accepted Solutions
agustinbobba
Contributor

Re: Accumulative sums - conditional in aggregation

Hi Jacek,

Maybe i misunderstood but i tried to recreate your scenery.

First you cant use the name of the column for the aggregarion funtion only values of a field.

Here I attach you an example, maybe can help you to make some changes on your model.

Best regards,

Agustin

View solution in original post

3 Replies
MVP
MVP

Re: Accumulative sums - conditional in aggregation

You can only use field names as dimensions in the aggr() function, no functions allowed.

But you can use a dollar sign expansion to evaluate your condition and replace with the output before the expression actually gets parsed:

sum(

aggr(

     rangesum( above( sum(Sales),0,12) )

,Month,

$(=if(getselectedcount(red)>0,'red',   if(getselectedcount(white)>0,'white',     if(getselectedcount(black)>0,'black'))))

)


edit:

Remember: red, white and black need to be fields in your data model, and QV is case sensitiv

agustinbobba
Contributor

Re: Accumulative sums - conditional in aggregation

Hi Jacek,

Maybe i misunderstood but i tried to recreate your scenery.

First you cant use the name of the column for the aggregarion funtion only values of a field.

Here I attach you an example, maybe can help you to make some changes on your model.

Best regards,

Agustin

View solution in original post

jaryszek2
Contributor

Re: Accumulative sums - conditional in aggregation

Thank You Guys!

It is working thanks to yours solution, Im happy 😉