Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

sureshqv
Esteemed Contributor III

Multi selections

Hi all,

i need small help  , i am caluclating the YOY growth in stright table  so i have a list box with values like 2017Q1 to 2018Q3   so the expression which i used is working fine with single selection but  when i tried to select multiple values the result is showing null   ... how to avoid this ?  below is my expresion

HW YoY Growth : =IF(Quarter = vNewMaxQtr,(($(vHWFCYOYServ)- $(vHWRevYOYServ)) / $(vHWRevYOYServ)), (($(vHWACTYOYServ)-$(vHWRevYOYServ)) / $(vHWRevYOYServ))

 

Current Quarter:    HW Forecast / HW Revenue

**********************************************************************************************************************************************************************************

vHWFCYOYServ = if(max(Dimensionality())=1, 

sum({$<Quarter={$(vCurQtr)},Service_PL={'HWR'},Type={'HW Forecast SR'}>}Service_Amount),

if(max(Dimensionality())=2, 

sum({$<Quarter={$(vCurQtr)},Service_PL={'HWR'},Type={'HW Forecast SSR'}>}Service_Amount),

if((Dimensionality())=0,

sum({$<Quarter={$(vCurQtr)},Service_PL={'HWR'},Type={'HW Forecast SR'},Sub_Region=>}Service_Amount)+sum

({$<Quarter={$(vCurQtr)},Service_PL={'HWR'},Type={'HW Forecast SSR'},sub_sub_region=>}Service_Amount)))) 

 

vHWRevYOYServ = Sum({$<Quarter={$(vPrevQtr)},Type={'HW Actuals'}>}Hardware_Revenue_Amt) 




can anyone have idea please help on this?


thanks

Chanty

Tags (2)
1 Solution

Accepted Solutions
felipedl
Valued Contributor III

Re: Multi selections

Chanty,

I've put a wrong chr(39) char on the string, the expressions should be this:

vCurQtr: =chr(39)&concat(Quarter,chr(39)&','&chr(39))& chr(39)

and

vPrevQtr: =chr(39)&concat((Left(Quarter,4)-1)&Right(Quarter,2),chr(39)&','&chr(39)) & chr(39)

So it gets all values encapsulated in the quotes, like so:

sample.png

14 Replies
Arjunarao
Honored Contributor II

Re: Multi selections

Upload some sample data with the qlikview file.

MVP
MVP

Re: Multi selections

With information that you have provided its pretty hard to give informed advice.

I recommend that you upload a small sample with the table, your variables and expressions and sufficient data to populate the table. It does not have to be real data, but it must contain the structure.

As always with expressions with nested variables, its best to try and get the expression to work with out the variables first and then replace parts of the expression with the variables one a a time. That way your are solving a single problem and you have a working table as a starting point.

sureshqv
Esteemed Contributor III

Re: Multi selections

Here is my  varaible values for

vCurQtr  =chr(39) & RIGHT(Quarter, 6) & chr(39)

vPrevQtr  =chr(39)&(left(RIGHT((Quarter), 6), 4)-1)& Right(RIGHT((Quarter), 6), 2)&chr(39)

in above variables how can i include for multiple selections ?  loveisfail

Petter Skjolden

felipedl
Valued Contributor III

Re: Multi selections

Hi Chanty,

Attached the QVW and a pic i've mentioned.

Hope it helps.sample.png

sureshqv
Esteemed Contributor III

Re: Multi selections

thanks Felip let me check and update you

felipedl
Valued Contributor III

Re: Multi selections

Sure no problem, hope this one helps you .

felipedl
Valued Contributor III

Re: Multi selections

Chanty,

I've put a wrong chr(39) char on the string, the expressions should be this:

vCurQtr: =chr(39)&concat(Quarter,chr(39)&','&chr(39))& chr(39)

and

vPrevQtr: =chr(39)&concat((Left(Quarter,4)-1)&Right(Quarter,2),chr(39)&','&chr(39)) & chr(39)

So it gets all values encapsulated in the quotes, like so:

sample.png

Re: Multi selections

The best way can using this as well.

vCurQtr  = Concat(DISTINCT Chr(39) & RIGHT(Quarter, 6) & Chr(39),',')

vPrevQtr  = Concat(DISTINCT Chr(39) & (left(RIGHT(Quarter, 6), 4)-1)& Right(RIGHT(Quarter, 6), 2)) & Chr(39),',')

sureshqv
Esteemed Contributor III

Re: Multi selections

thanks anil.    Felip expression is working  fine. let me check yours aswell.

Community Browser