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

set analysis Query

Hi All,

I have an expression written in if condition would like to change it to set analysis..Here are those expressions..

If condition :  sum(Flag_ID*if(Year =  {'$(vMaxYear)'} Sales)

Set analysis : sum(Flag*_ID* sum({< Year= {'$(VMaxYear)}>} Sales ) )

The set analysis is not working.. can some one tell me what is going wrong in this...

Thanks in advnace....

17 Replies
lironbaram
Partner - Master III
Partner - Master III

just a quick look you seem to miss on ' in the set analysis and the variable is written diffrently in the set analysis

and you need the set analysis in both sums

may be try

sum(({< Year= {'$(vMaxYear)'}>} Flag*_ID* sum({< Year= {'$(vMaxYear)'}>} Sales ) )

Not applicable
Author

Hi Liron,

      Let  me explain u more clearly. I have a variable named vTest which holds the name of a flag field(Flag_ID).Flag_ID has 0,1 values..

here is my if condition : sum([ $(=vTest)] * if(Year = vMaxyear ,Sales))

I want the above expressiojn to be changes to set analysis completely..

The expression u have provided is  not working..

Please let me know if u have any more suggestions..

Thanks

Not applicable
Author

Hi All,

Do any one have any suggestions???

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Try using this expression

     sum({< Year= {$(=VMaxYear)}>} Sales )* Flag_ID

Hope it helps

Celambarasan

Not applicable
Author

Hi,

Thanks for reply..

But that is not working

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     What dimensions you have in that chart?

     Your expression Needs Aggr function I think.

     May be like this

     Sum({< Year= {$(=VMaxYear)}>} Aggr(Flag_ID *Sum(Sales),UniqueFieldName))

Celambarasan

Not applicable
Author

Hi,

I have VALUELIST function used in the dimesnion to calculate the dimension names dynimically in the chart.. In the expression tab the same VALUELIST is used and to that different conditions are given to pick the appropriate calculation for the different dimension values declared in the Dimensions tab..

I am testing the expression u have given in the text object.. It is not returning any value..

Plz let me know if u need any clarification..

Thanks

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Flag_ID is a variable or field?

     If Field what is the use of that? because you stated that it has 0,1 values only then if you multiply with 0 then it will get zero for some results?

If Flag_ID is field then try with this expression

     =Sum({< Year= {$(=VMaxYear)},Flag_ID={1}>} Sales)

Celambarasan

Not applicable
Author

I have a variable vTest which holds the name of the filed called Flag_ID.. the expression u have posted seems to be good but I have tested the same in text object it does not return any value...