Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
dreweezy
Partner - Creator II
Partner - Creator II

checking syntax for my expression given a variable

Hi,

I have created a variable with 3 buttons that should change my 2 charts based on these buttons. 

Button 1: Source

Button 2: Fund

Button 3: ALL

--

Chart 1:  bar graph to show me the count of statuses pending given the selection of a button

if(vSourceFund = 1, count({<Bucket = {"Source"}>} STATUSES),
if(vSourceFund = 2, count({<Bucket = {"Fund"}>} STATUSES),
count({<Bucket> count))

I know my syntax is incorrect but I am trying to achieve the count given the buckets of Source or Fund. And if "ALL" button is selected I want it to count all the buckets. Any thoughts? Thank you.

Labels (3)
10 Replies
tincholiver
Creator III
Creator III

Do you want the graphic to make the graphics according to the selections of those buttons?
have you tried with an adhoc analysis?

dreweezy
Partner - Creator II
Partner - Creator II
Author

Yes, I'd like to render my charts based on my expression/syntax. Not looking for ad-hoc analysis as I am trying to make this dashboard interactive as possible.

tincholiver
Creator III
Creator III

Is that exactly what adhoc analysis does is to give interactivity to the graphics given that it can be assembled according to the selections made by the user both in the dimensions and in the expressions. I know how to achieve it with selectors but not with buttons
dreweezy
Partner - Creator II
Partner - Creator II
Author

I see. I think more or less they both function the same but just a different way. 

tincholiver
Creator III
Creator III

With selectors you do not have to make modifications in the expression, you solve it with show conditional
sivakumar1994
Contributor III
Contributor III

Try this and let us know
if($(vSourceFund)= 1, count({<Bucket = {"Source"}>} STATUSES),
if($(vSourceFund )= 2, count({<Bucket = {"Fund"}>} STATUSES),
count( TOTAL <Bucket> count))
dreweezy
Partner - Creator II
Partner - Creator II
Author

Thank you, I have tried but no success. My chart is not showing any data. This syntax should be working because it is exactly what I want to do. I want the count of the status for the bucket - SOURCE when it is selected on button and count of the status for the bucket - FUND when that button is selected and if else show me all - which would be the total.. This really should be working and cannot think what is the issue with this syntax..

dreweezy
Partner - Creator II
Partner - Creator II
Author

Ok -- i figured it out. 

if($(vSourceRequestor)= 1, count({<Bucket = {"Source"}>} STATUS),
count({<Bucket = {"FUND"}>} STATUS))

When I configured my expression like this it works fine. But how do I incorporate the if else "show me all" part? 

dreweezy
Partner - Creator II
Partner - Creator II
Author

Ok, so to update I was able to incorporate the if else part to show me 'all' which is essentially the sum of my 2 buckets of source and fund. 

if($(vSourceRequestor)= 1, count({<Bucket = {"Source"}>} STATUS),
if($(vSourceRequestor)= 2, count({<Bucket = {"Fund"}>} STATUS),
count(STATUS)
)
)

New problem that I cannot for the love of god figure out.. the if else statement of giving me the count of all the status are not matching up correctly. 

ALL = bucket(Source) + bucket(Fund)

the status numbers are matching up except for one value 'Complete' where it is somehow adding an additional 10. The total should be 250 but it is showing as 260 when I select the 'ALL' button. I have tried excluding the null values and everything. Anyone have have idea?