Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
QLIKWORLD LIVE! MAY 16 - 19TH, EARLY BIRD DISCOUNTS! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
aditi_haldule
Contributor III
Contributor III

creating variables in load editor

Hi, I'm new to scripting in qlik sense.

I actually need to create 2 buttons: one is 'conversion count'  which makes conversion count as a measure for all the bar charts in my dashboard 

where

conversion count  =Count( ID) - Count(<Conversion_MONTH={'NC'}>}ID) has this formula (here conversion month and ID are the columns already present in my table) and the second button should be 'revenue' which makes the measure as 'revenue' for all the bar charts in my dashboard

where

revenue = sum(total_ revenue)..(here total_revenue column is already present in my data)

So to create these buttons I need to first create variables in the load editor and then make changes in the measure and change it's condition to if -else

but how do I do this exactly? please help.

Thanks in advance.

2 Replies
Or
Master II
Master II

It sounds like you only need one variable here, which toggles between Count and Revenue. You can do this using a variable, e.g.

Let vButton = 'Count'; // If revenue is the default, change to revenue

You would then add a button which toggles vButton to Revenue (if it's count) or Count (if it's Revenue) using a simple If() statement.

In your objects, you would probably be best off using an if() statement in a single measure - if(vButton =  'Count',CountFormulaHere,RevenueFormulaHere), but you could also use calculation conditions on two measures if you prefer - if(vButton=Count,1,0) and if(vButton=revenue,1,0) respectively.

aditi_haldule
Contributor III
Contributor III
Author

ok. I'll try this.