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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
canmarroig
Partner - Creator
Partner - Creator

Action buttons on two variables

Hi, i'm facing this problem: i've a bar graph where i'm showing

sum(sales)

count(customers)

sum(goodsdelivered)

etc.

My customer is asking me to have an action button for switching from sum to avg. No problem i've created a variable vAggr to do it

if(vAggr='sum', sum(sales), if(vAggr='avg', avg(sales))

Then he asked me to cycle on time dimension not with a classic QV symbol but he wants further buttons to set Year, Month,ecc

I tried with a further variable vTime but when i try to use it, it stops calculating avg. I use this expression:

if(vAggr='sum', sum(sales), if(vAggr='avg', sum(sales)/count (distinct $(vTime)))

Where is the problem, i can't see it. Tks

7 Replies
Not applicable

Hi,

What you have in the variable $(vTime)

v_iyyappan
Specialist
Specialist

Hi,

I assume vTime like Year, Month based on button selection it will change the Year or Month.

using the Conditional option in expression use like this

vTime = 'Year'

if(vAggr='sum', sum(sales), if(vAggr='avg', sum(sales) / Count (distinct Year)))

vTime = 'Month'

if(vAggr='sum', sum(sales), if(vAggr='avg', sum(sales) / Count (distinct Month)))


Hope its help.


Otherwise provide the sample app for that


Regards,

Not applicable

Hii Amuthabharati,

I am attaching a file for the same button action, go for it ,

Hope it helps.

jagan
Partner - Champion III
Partner - Champion III

Hi,

Please find attached file, hope it helps you.

Regards,

Jagan.

canmarroig
Partner - Creator
Partner - Creator
Author

I've Year, Month, Week, Fiscal Quarter, Date

canmarroig
Partner - Creator
Partner - Creator
Author

Yes, correct for sum or avg but also to cycle on x axis dimension i need furrther buttons

jagan
Partner - Champion III
Partner - Champion III


Hi,

PFA file for solution.

Regards,

Jagan.