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: 
alan_grn
Creator II
Creator II

Toggle in graphs

I am new to QlikView and am trying to do the following:

I have a calendar setup with days, weeks, months and prodcuts in my databse.

I am able to show a line graph for all prodcuts (Total of all) or a graph listing each individual prodcuct (Multiple lines) I would like to be able to toggle the graph between showing the graph as a single line or as multiple lines depending on a user selction. What si the best practice to do this?

I also wantto be able to to adjust the formula base don another selection. If Daily is slected then SUM otherwise AVG. Can someone please tell me if this is possible.

12 Replies
disqr_rm
Partner - Specialist III
Partner - Specialist III

THis can be achieved in many ways. One of the way you could take is. you can define a variable vExpression:

if(Type='Daily', 'sum(field)', 'avg(field)')

And then use this $(vExpression) as the expression of the chart.

To toggle, you could to the same trick with dimensions, or even can have 2 charts on same position and enable/disable them with a condition checking what is selected.

Still a problem, please post a sample qvw and someone here will provide a solution for your reference.

Hope this helps.

alan_grn
Creator II
Creator II
Author

Thanks. Sorry about this, but this new to me. I have managed to get the variable to work, but my time series all has the same value. (Sum of all time).

The expression is Sum([Amount]). How do I chaneg this so that it sums an amoutn for each Day.

Are you abel to answer the second aprt of my question above?

disqr_rm
Partner - Specialist III
Partner - Specialist III

I already answered your sencond question.

Define a variable vExpression (under Settings -> Variable Overview menu) and put the value

=if(Type='Daily', 'sum([Amount])', 'avg([Amount])')

Then in the expression section of your chart use =$(vExpression) as expression. I am assuming the field name is "Type" which contains Daily or other values.

alan_grn
Creator II
Creator II
Author

Thanks will give it another try.

Regarding the variable. The formula changes correctly, but this add all time periods together. (i.e. each dat point has the same value but different days. How do I get this to sum for each day?

disqr_rm
Partner - Specialist III
Partner - Specialist III

What is your dimension? Do you have TOTAL in your sum in expression?

I am not able to upload documents here for some reason. THis new Forum is giving me problems.

I can email it to you, if you provide one.

alan_grn
Creator II
Creator II
Author

Thanks for your help on this. I have created a simple example.

[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/2553.Test.zip:550:0]

For variable vExp I get a straight line. It is summing the entire population and not by date.

I would alos like to see if it is possibel to toggle the diemnsion. Setting 1- Date, Setting 2would be Date and Product.

disqr_rm
Partner - Specialist III
Partner - Specialist III

Use


='sum(total <Date, Product> [Value])'


as variable value. Please pay attention to single quotes around.

and put

=$(vExp)

in the expression.

alan_grn
Creator II
Creator II
Author

Thanks that worked. Now to play around and see if I can get it to work for the dimension.

Thanks for your help. It is really appreciated.

alan_grn
Creator II
Creator II
Author

Quick question. How would I do this for the Dimension.

I want this to be for Date and Product.