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

Announcements
Congratulations to the new Qlik Luminary and Partner Ambassador class! Meet them here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Ratio in a bar chart

Hi guys

I'm still a rookie and need some simple help.

How can I show the ratio within a field in a bar chart every month?

Fx. for one month I have a field "PRODUCT" within the field i have "Product 1" "Product 2" etc. If I chose "Product 1" I can see that it has been sold 10 times(frequency), for "Product 2" 30 times(frequency) etc.

I want to make a bar that show the ratio between "Product 1" and the others. If we only had the two products for one month the ratio would be 10/30 = 33.3 %.

Please let me know if you need me to clarify anything

Thanks!

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Did you replace MonthYearField with Month? MonthYearField was a placeholder and needed to be replaced with the field you were using in your chart.

Like jason.michaelides‌ mentioned, try this

Sum(Frequency)/(Sum(TOTAL <Month> Frequency)-Sum(Frequency))

View solution in original post

8 Replies
Jason_Michaelides
Partner - Master II
Partner - Master II

Sum(Frequency)/(Sum(TOTAL Frequency)-Sum(Frequency))

Hope this helps,

Jason

sunny_talwar
MVP
MVP

May be you need this:

Dimension:

MonthYearField

PRODUCT

Expression:

Count(PRODUCT)/(Count(TOTAL <MonthYearField> PRODUCT) - Count(PRODUCT))

Not applicable
Author

Hmm it doesn't work.

I have chosen Month and Product as dimension and as expression the text you have wrote.

The values are wrong and I get a bar chart with all the products I have, I only need to show Product 1 / Product(all products) and then on a monthly basis.

Jason_Michaelides
Partner - Master II
Partner - Master II

Sum(Frequency)/(Sum(TOTAL <Month> Frequency)-Sum(Frequency)) should work. Can you share your app please?

sunny_talwar
MVP
MVP

Did you replace MonthYearField with Month? MonthYearField was a placeholder and needed to be replaced with the field you were using in your chart.

Like jason.michaelides‌ mentioned, try this

Sum(Frequency)/(Sum(TOTAL <Month> Frequency)-Sum(Frequency))

MarcoWedel
MVP
MVP

Hi,

one example might be:

QlikCommunity_Thread_231679_Pic3.JPG

QlikCommunity_Thread_231679_Pic1.JPGQlikCommunity_Thread_231679_Pic2.JPG

QlikCommunity_Thread_231679_Pic4.JPG

QlikCommunity_Thread_231679_Pic5.JPG

QlikCommunity_Thread_231679_Pic6.JPG

QlikCommunity_Thread_231679_Pic7.JPG

or to avoid "Errors in expression" enumerating all fields of the dimension group in the total qualifier (instead of the group name itself):

QlikCommunity_Thread_231679_Pic8.JPG

One note: If you compared the sales of one product to the sales of all products (including itself), the usage of stacked bars might be an option:

QlikCommunity_Thread_231679_Pic9.JPG

hope this helps

regards

Marco

Not applicable
Author

It worked! Thanks!

Not applicable
Author

It's working - thanks!