Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
Showing results for 
Search instead for 
Did you mean: 
Contributor III
Contributor III

Altered States for What If study

I have a Bar Chart that models Demand v Capacity for a region across a number of sites.  I would like to be able to see how the charts look if we add or remove demand to a specific plant(s).  I created a variable to enter the amount of change but I need to apply that change to only a single site.  I added a list box under an alternate state to allow a site to be selected but I cannot get the chart to add the entered amount of change to the selected plant.  I can add the amount to all the plants but not just the selected one.  I tried adding the below formula to the expression but i believe I have the sytax wrong

       +if([PLT AB]={EW1}[PLT AB],vIncrease,0)


PLT AB - Is the site dimension in the chart

EW1 - Is the Alternate State name (The list box uses dimension PLT AB)

vIncrease - is the created variable for amount of change


Is there a way to apply that change to only the selected plant? 


1 Reply

you do not need alternate states for this requirement, you just need the two variables for Site and demand:


the first table shows te original demand, 2nd table shows the demand + entered demand, 3rd table shows the demand replaced (for specific site), here are the expressions:

=sum(demand) + if(site=vSite,vDemand,0)  - if you want the entered demand added
=if(site=vSite,vDemand,sum(demand)) - if you want it replaced

assuming site and demand are your fields