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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
canmarroig
Partner - Creator
Partner - Creator

Multi variable help requested

Hi, i need a help to solve my problem:

i'm making a simulation on changing of costs, not only 1 variable but as many as items in my catalogue:

=sum({$<ITEM={'A'}>}cost)*(1+vAdelta)

+sum({$<ITEM={'B'}>}cost)*(1+vBdelta)

+sum({$<ITEM={'C'}>}cost)*(1+vCdelta)

+sum({$<ITEM={'D'}>}cost)*(1+vDdelta)

+sum({$<ITEM={'E'}>}cost)*(1+vEdelta)

this is perfect if i'm calculating TOTAL, but if a select only 1 item, how can i have only ONE cost simulation?

Thanks

Labels (1)
1 Solution

Accepted Solutions
sushil353
Master II
Master II

Hi,

You can add another variable having values 0 or 1 and then assign the value of variable as 1 as per the selection.

=sum({$<ITEM={'A'}>}cost)*(1+vAdelta)*vA

+sum({$<ITEM={'B'}>}cost)*(1+vBdelta)*vB

+sum({$<ITEM={'C'}>}cost)*(1+vCdelta)*vC

+sum({$<ITEM={'D'}>}cost)*(1+vDdelta)*vD

+sum({$<ITEM={'E'}>}cost)*(1+vEdelta)*vE

Create variable as vA = Alt(substringcount(getfieldselection(ITEM),'A'),0)

vB = Alt(substringcount(getfieldselection(ITEM),'B') ,0)

and so on..

HTH

Sushil

View solution in original post

2 Replies
MK_QSL
MVP
MVP

=sum({$<ITEM={'A'}>}cost)*If(GetFieldSelections(ITEM)='A',vAdelta+1,1)

and so on

sushil353
Master II
Master II

Hi,

You can add another variable having values 0 or 1 and then assign the value of variable as 1 as per the selection.

=sum({$<ITEM={'A'}>}cost)*(1+vAdelta)*vA

+sum({$<ITEM={'B'}>}cost)*(1+vBdelta)*vB

+sum({$<ITEM={'C'}>}cost)*(1+vCdelta)*vC

+sum({$<ITEM={'D'}>}cost)*(1+vDdelta)*vD

+sum({$<ITEM={'E'}>}cost)*(1+vEdelta)*vE

Create variable as vA = Alt(substringcount(getfieldselection(ITEM),'A'),0)

vB = Alt(substringcount(getfieldselection(ITEM),'B') ,0)

and so on..

HTH

Sushil