Print Page | Close Window

Percentage breakdown in a bar char

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22576
Printed Date: 06 May 2024 at 2:15am


Topic: Percentage breakdown in a bar char
Posted By: achandana01
Subject: Percentage breakdown in a bar char
Date Posted: 16 Apr 2018 at 4:26am

I need to display a bar chart that is broken down by percentage wise. Here is a sample data

All Completed activity under 30 mins

Req ID     Employee TAT(Mins)
1     A     29
2     A     28
10     B     25
11     B     27
13     B     31

A - 2/2= 100% B 2/3 = 67%

In the chart I need by employee and their completed activity percentage in Green and not completed activity in red.

A is all green
B is 67% green 33% red.

I couldn't able to post the image here, I hope this helps.

Thanks


-------------
chand



Replies:
Posted By: hilfy
Date Posted: 16 Apr 2018 at 1:11pm
This is an interesting challenge!

You'll need to use a stacked bar chart and you'll place it in an Group or Report Footer (or possibly Header - NOT in Details!) You'll also need an employee group so that you can count the number of requests per employee.

Then you'll need something like these formulas:

{@NumComplete}
if {MyTable.TAT} < 30 then 1 else 0

{@NumNotComplete}
if {MyTable.TAT} >= 30 then 1 else 0

{@PercentComplete}
if DistinctCount({MyTable.RequestId}, {MyTable.EmployeeGroupField}) > 0 then
Sum({@NumComplete}, {MyTable.EmployeeGroupField}) % DistinctCount({MyTable.RequestId}, {MyTable.EmployeeGroupField})

{@PercentNotComplete}
if DistinctCount({MyTable.RequestId}, {MyTable.EmployeeGroupField}) > 0 then
Sum({@NumNotComplete}, {MyTable.EmployeeGroupField}) % DistinctCount({MyTable.RequestId}, {MyTable.EmployeeGroupField})

You'll then graph the two "Pct" formulas per employee and change the color of the bar to green and red.

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: achandana01
Date Posted: 19 Apr 2018 at 10:37am
Thank you very much for your help :)

-------------
chand



Print Page | Close Window