Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
Contributor

How to add Alternate States to a variable as a parameter

Hi,

I have the following variable below.  How do I add Alternate States as a parameter to this variable.

vSpend = Sum({<$($1), BRANDLINK={'$2'}>}DISTRIBUTION_AMOUNT)

The Alternate States I have are :  Alternate1, Alternate2 and Alternate3

         

$1 - is used for period - ie YTD, MTD , etc...

$2 - are different brands

Kind regards,

Nayan

24 Replies
Highlighted

Re: How to add Alternate States to a variable as a parameter

May be this

vSpend = Sum({[$3]<$($1), BRANDLINK={'$2'}>}DISTRIBUTION_AMOUNT)

Highlighted
Contributor

Re: How to add Alternate States to a variable as a parameter

Hi Sunny

Thank you for your reply, however it did not work. I get a blank.

Kind regards

Nayan

Highlighted
Contributor

Re: How to add Alternate States to a variable as a parameter

Hi Sunny

Here is my expression.  Is the state in the correct place

$(Alternate1,vSpend(vYTD))

Kind regards

Nayan

Highlighted

Re: How to add Alternate States to a variable as a parameter

No, Please post full condition

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted

Re: How to add Alternate States to a variable as a parameter

What is vYTD now?

Highlighted
Contributor

Re: How to add Alternate States to a variable as a parameter

Hi Anil

My expression without Alternate States  $(vSpendTest(vYTD,FNB)) when expanded is as follows:

Sum({<Year = {'2018'},Period_ID = {"<100"}, BRANDLINK={'FNB'}>} DISTRIBUTION_AMOUNT)

where vYTD :  Year = {'$(vMaxYear)'}, Period_ID = {"<=$(vMaxMonth)"}

Hope this helps.

Kind regards

Nayan

Highlighted

Re: How to add Alternate States to a variable as a parameter

May be try this

$(vSpendTest(vYTD,FNB, Alternate1))

Highlighted
Contributor

Re: How to add Alternate States to a variable as a parameter

vYTD will be all transactions up to today.  So now will be October 2017.  The year, 2018,  shown in my reply to Anil , thats the Financial Year.

So what i'm trying to achieve is that I have a Chart Table where I want to create expressions where some are related to Alternate States.  I have 3 different list boxes with different Alternate States, and when I select a value from one of the list boxes, it should only affect the expression linking to that list box.

Hope I'm making sense.

Kind regards

Nayan

Highlighted
Contributor

Re: How to add Alternate States to a variable as a parameter

Hi Sunny

I've tried that, there is a value, but not affected by the selections made in List box relating to Alternate State 1.

kind regards

Nayan