Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

calculation in bar chart

Hi,

i have a question about showing the data value in a bar chart. I want to show sales contribution from one Area (let's say Area A). Area A has total sales 5000 and total sales of ALL area is 20000. The contribution of Area A must be 5000/20000 --> 0.25 (25%) . but when i use bar chart (with area dimension) the result return 1, i use this formula --> sum({Area ={'A'}}sales) / sum(sales). anyone knows the solution ? really appreciate your help, thanks

1 Solution

Accepted Solutions
crusader_
Partner - Specialist
Partner - Specialist

Dear Indra,

In fact in your example you need to use TOTAL, because when you use Area as Dimension and reduce its values by Set Analysis as result sum( {<Area={'A'}>} Sales) equal sum(Sales) in the same expression. If you add new expression sum(Sales) there will not equal sum(Sales) in your first expression.

To understand more deeply this process find attach a bit modified example.

Hope this helps you.

Regards,

Andrei

View solution in original post

4 Replies
robert_mika
Master III
Master III

Try:

sum({<Area ={'A'}>}sales) / sum(sales)

Not applicable
Author

Hi Robert, sorry for late reply,

i have try the formula. but it returns 1 (100%) not 0.25 (25%).

can you help me please.

This is my file,

Regards,

Indra

crusader_
Partner - Specialist
Partner - Specialist

Dear Indra,

In fact in your example you need to use TOTAL, because when you use Area as Dimension and reduce its values by Set Analysis as result sum( {<Area={'A'}>} Sales) equal sum(Sales) in the same expression. If you add new expression sum(Sales) there will not equal sum(Sales) in your first expression.

To understand more deeply this process find attach a bit modified example.

Hope this helps you.

Regards,

Andrei

Not applicable
Author

Dear Andrei,

Wow, thanks for your explanation, it solved my problem.

Thanks Andrei

Regards,

Indra