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

Calculating percentage value in a chart

Hi,

I have one bar chart with two dimensions

1) MonthYear (which has values like Jan 2010, Feb 2010, etc)

2) Type (which has values 'A', 'B' and 'C')

The expression shows the count of books for selected date range (I have two calender objects for that) for the respective monthyear and type.

It is working fine, but what I need to display is percentage of each type of books for respective months.

For e.g. in Jan 2010; there are total 500 books, out of which 100 are of type A, 200 each of type B and C.

I want to display for Jan 2010, for type A, 20%, for type B and C 40% each. This should vary as per the count of books for other months.

I am not getting how to achive it. Could you please help me out? Thanks in advance.

My expression is

=count({<Date = {">=$(vFromDate) <=$(vToDate)"}>} BookID)

(As I am having personnel edition of qlikview; I will not be able to open any external .qvw file)

13 Replies
jagannalla
Partner - Specialist III
Partner - Specialist III

=count({<Date = {">=$(vFromDate) <=$(vToDate)"}>} BookID) / count({<Date = {">=$(vFromDate) <=$(vToDate)"}>}    Total BookID)

Check Show in Percent(%) in number tab for the exp

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     If you have a field in the name month year then,

     Try with this expression,

     =Count(Books)/Count(Total <MonthYear> Books)

     Check the in percentage option in the number tab of the chart properties.

Hope it helps

Celambarasan

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try the following expession

=Count({<Date = {">=$(vFromDate) <=$(vToDate)"}>} BookID) /

Count({<Date = {">=$(vFromDate) <=$(vToDate)"}>} Total <MonthYear> Books)

Regards,

Jagan

Not applicable
Author

Hi,

This expression gives me wrong results. I have 36 books of type 'A' and 23 books of type 'B' in the month of Jan 2010. So th total books  = 59. So my requirement is that while showing percentage for Jan 2010, it should be based on 59. i.e.type 'A' books = 61.01% and 38.93%. But after implementing the solution given by you, it is giving results as type 'A' books = 27% and type 'B' books = 17% which is wrong.

Not applicable
Author

Hi,

This expression gives me wrong results. I calculated a field in script as MonthYear = monthname(Date). I have 36 books of type 'A' and 23 books of type 'B' in the month of Jan 2010. So th total books  = 59. So my requirement is that while showing percentage for Jan 2010, it should be based on 59. i.e.type 'A' books = 61.01% and 38.93%. But after implementing the solution given by you, it is giving results as type 'A' books = 2% and type 'B' books = 1% which is wrong.

Not applicable
Author

Hi,

This expression gives me wrong results. I calculated a field in script as MonthYear = monthname(Date). I have 36 books of type 'A' and 23 books of type 'B' in the month of Jan 2010. So th total books  = 59. So my requirement is that while showing percentage for Jan 2010, it should be based on 59. i.e.type 'A' books = 61.01% and 38.93%. But after implementing the solution given by you, it is giving results as type 'A' books = 2% and type 'B' books = 1% which is wrong.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Can you attach the Qlikview file.  It would be useful to solve.

Regards,

Jagan.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Please check the attached file for solution.

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Hi,

I cant attach qlikview file. Also I can't open your file as I have

personnel edition of qlikview.

On Mon, Feb 13, 2012 at 1:35 PM, jagan mohan <