# New to QlikView

Discussion board where members can get started with QlikView.

Announcements

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.

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
Valued Contributor III

## Calculating percentage value in a chart

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

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

MVP

## Calculating percentage value in a chart

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

MVP & Luminary

## Calculating percentage value in a chart

Hi,

Try the following expession

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

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

Regards,

Jagan

Not applicable

## Calculating percentage value in a chart

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

## Re: Calculating percentage value in a chart

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

## Re: Calculating percentage value in a chart

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.

MVP & Luminary

## Calculating percentage value in a chart

Hi,

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

Regards,

Jagan.

MVP & Luminary

## Re: Calculating percentage value in a chart

Hi,

Please check the attached file for solution.

Hope this helps you.

Regards,

Jagan.

Not applicable

## Re: Calculating percentage value in a chart

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 <

Community Browser