Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

computing values on a bar chart based on a variable

Hi All,

I am trying to create a qlikview bar chart with 2 bars, one showing the selected client's (saying C1) value (say sales) and other showing the average of 4 clients sales (say C1 C2 C3 C4)....I am not able to compute average AND show the individual client value ....Client can change so I also need an option to change the client (I have kinda got that worked out by creating a variable for it).... It would be great if someone please help me with a sample example or any other suggestions welcome

In short looking to create a bar chart showing with 2 bars (Client and Average) and an option to change the client

Thanks for the help.

Karthik

8 Replies
Not applicable
Author

The simplest and quickest I could think of was to display all four dimensions on x-axis along with total as the fifth dimension. Pls see attached.

Thanks

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Expression for selected Client:

=Sum(Sales)

Expression for remaining Clients:

=Sum({1-$}Sales) /Count({1-$} DISTINCT Client)

Hope this helps you.

Regards,

Jagan.

djsampat
Creator II
Creator II

I have combined the two earlier responses and made a sample file to match your requirement using a Resident Load.

Average Sales

If this helped you, please mark as Helpful. If it solves your issue, please mark as Answer

If you are viewing this topic and found it informative, please like my comment.

Regards

Dhruv

Not applicable
Author

Dhruv,

Thank you for the response. This was close...sticking to your example, I have more than 100 products so its not feasible for me to show all products in a single chart .... is there an option where we can have an Input Box and select a company to dynamically change the <client> on the chart?

I tried your resident load method, it gives me the following error

Table not found

Average:

LOAD

Sum([Overall Impact From 3R's])/Count(DISTINCT [Overall Impact From 3R's]) as Averageoverallimpact3Rs

resident [Overall Impact From 3R's]

Instead of the above .. can I just not have another expression for average? like avg(sales) ?

Please let me know what you think.

Thanks

Karthik

Not applicable
Author

Please see attached. I think this should work for you. You will have only two bars. One for the product and the other is total.

Thanks

Not applicable
Author

Ajay, I do not see any attachment from you? Can you please resend the attachment? Thanks.

Not applicable
Author

Can you see it now?

djsampat
Creator II
Creator II

You can use either of the following:-

avg(TOTAL Sales)

or

avg({1} TOTAL Sales)

If this helped you, please mark as Helpful. If it solves your issue, please mark as Answer

If you are viewing this topic and found it informative, please like my comment.

Regards

Dhruv