Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis with if condition

Hi All,

      

            I have a below set expression this is Calculates variance of max edition - previous edtion for a  year

$(vpreviousVariance)= pick(($(vSlider))/12,avg({<MaxEdition={1}>}$(v12m)) -

avg({<PreviousEdition={1}>}$(v12m)),avg({<MaxEdition={1}>}$(v24m)) -

avg({<PreviousEdition={1}>}$(v24m)),avg({<MaxEdition={1}>}$(v36m)) -

avg({<PreviousEdition={1}>}$(v36m)),avg({<MaxEdition={1}>}$(v48m)) -

avg({<PreviousEdition={1}>}$(v48m)),avg({<MaxEdition={1}>}$(v60m)) -

avg({<PreviousEdition={1}>}$(v60m)))

I have different  groups(ABC,DEF,XYZ...etc) now i have to extract the variance for each groupfor this am trying to write the if condition for each group like $(vpreviousVariance)= pick(($(vSlider))/12,if(GROUP1='ABC', (avg({<MaxEdition={1}>}$(v12m)) -avg({<PreviousEdition={1}>}$(v12m))),.....rest of the expression.

 

But its giving wrong result. So how can we combine if condition with set analysis here......

Labels (1)
21 Replies
whiteline
Master II
Master II

What is problem ?

Correcl Vx:

Vx=If(EditionMonth=1, '{<GROUP={"ABC"}, ModelYear={$(#=Only(ModelYear)-1)}, EditionMonth={"11"}>}','GROUP={"ABC"}, EditionMonth={"$(=$(vEdn)-2)"}>}')

Correct expression:

=round(pick(($(vSlider))/12,avg({$<Group={'ABC'}, EditionMonth = {$(#=Only(EditionMonth))}>}$(v12m)) - avg( $(vX) $(v12m) ),

avg({$<GROUP={'ABC'},  EditionMonth = {$(#=Only(EditionMonth))}>}$(v24m)) - avg( $(vX) $(v24m) ),

avg({$<GROUP={'ABC'},  EditionMonth = {$(#=Only(EditionMonth))}>}$(v36m)) - avg( $(vX) $(v36m) )))

jagan
Partner - Champion III
Partner - Champion III

Hi Anil,

Please find the attachment.

Regards,

Jagan.