Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

tester_sogeti
Contributor

Aggr and variables

Hi! This is the continuation of my previous threat Agreggation and set analysis with parameters

What happens is that i need the implement the solution in a very particular way.

I have a table (like the one in the sample data), and i want to call in an expression a variable(with the ID conditional) that will call the final variable(the one with aggr and the one that actualy does the calculations).

I add my sample data updated with this solution (or tryal of it at least) and you will see it much clearly.

So it is something like this:

Expression:

EXPRESSION:    $(filter(FY={'FYQ4'}))

Variables:

filter:                      =if(ID=4,$(weightedmean($1)) )

weightedmean:    sum({<$1>} Aggr(DISTINCT Csat_Target * Weights, link_targets)) / sum( {<$1>} Aggr(DISTINCT Weights, link_targets) )   


How could I solve it? I really don't understand why it is not working! It is just calling variables!


Thanks,

I will try to look for your answers during the weekend Have a good weekend!


1 Solution

Accepted Solutions
Highlighted

Re: Aggr and variables

Hi Lluis,

I'm not sure. But try to remove the '=' sign for the variable 'filter'.  And add the 'ID' into the weightedmean variable.


Like


Variables:

filter:                      if(ID=4,$(weightedmean($1)) )

weightedmean:    sum({<$1>} Aggr(DISTINCT Csat_Target * Weights, link_targets,ID)) / sum( {<$1>} Aggr(DISTINCT Weights, link_targets,ID) ) 

2 Replies
Highlighted

Re: Aggr and variables

Hi Lluis,

I'm not sure. But try to remove the '=' sign for the variable 'filter'.  And add the 'ID' into the weightedmean variable.


Like


Variables:

filter:                      if(ID=4,$(weightedmean($1)) )

weightedmean:    sum({<$1>} Aggr(DISTINCT Csat_Target * Weights, link_targets,ID)) / sum( {<$1>} Aggr(DISTINCT Weights, link_targets,ID) ) 

tester_sogeti
Contributor

Re: Aggr and variables

Hei! Sorry for not answering i was out for the weekend!

This worked perfectly!

Thanks again!