Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Percent calculation by category
RCPDesign
Hello !
I have a Flat File data source (flatfile.csv).
I want to have the percentage of products for which "Ann? n" > = "Ann?e n-1" by product type and compared to each category
Example for Groupe A category :
I have 27 products :
6 with Type "T1" and only 3 satisfy the condition : "Ann?e n" >= "Ann?e n-1"
==> pourcentage = 3/6% = 50%
9 with Type "T2" and only 4 satisfy the condition : "Ann?e n" >= "Ann?e n-1"
==> pourcentage = 4/9% = 44.44%
12 with Type "T3" and only 9 satisfy the condition : "Ann?e n" >= "Ann?e n-1"
==> pourcentage = 9/12% = 75%
I managed to display the values ??for each category but I was not able to display the desired percentages from each category
in the second time I changed "Value Data" in "labels Series" with "Percentile Value Data" but the result is not good: the calculation is done with respect to all categories and not in relation to each category
Please Help ! How can I have a percent by cat?ogory X-Axis ??
Find more posts tagged with
Comments
mwilliams
Ok. Take a look at this modified version of your report. I deleted all your computed columns, because you don't need them. Instead, I used a single series, optional grouping, and a filter to do the same. You'll also see there is script in the onFetch of your dataSet to calculate the total number of values in each group (pre filter), which is stored in a global variable named in a way that you can recall it from your chart. Then, in the chart script, you'll see where I replace the current value of the label with the calculated percentage, using the data point value (post filter) and the corresponding value from the variables (pre filter total) we created. Hope this helps. Let me know if you have questions or if I've done something incorrectly.
RCPDesign
Hello!
thank you for your reply and help.
I tested the new version of the report but I got the infinite value for each series
see attachment.
I also have two questions about this solution :
1) How can customize the labels in the legend series ? (by script ? have you an example please ?)
2) How can customize the colors of the series ? (by script ? have you an example please ?)
Thank you in advance
mwilliams
Sorry. The issue was with using GlobalVariables instead of PersistentGlobalVariables. The design is fixed for non-preview outputs and colors and legend labels have also been addressed in the report. Take a look.
RCPDesign
Thank you
The result of calculating the percentages is OK.
But there remains one last problem on the y-axis, which is not consistent with the values displayed (see attached).
For example for group A: 50% for Type T1 > 44.44% for Type T2
est-il possible d'avoir l'axe des ordonn?es par pourcentage conform?ment aux valeurs affich?es ?
Tank you in advance
mwilliams
Oh. You want the bars to be the actual percentage? That requires a few changes. Take a look. I thought you had wanted the value represented and to show the percentage that n > n-1. I added a new binding in the chart, which I use for the y-axis value. I formatted the y-axis labels and set the scale min and max. I also change the chart script for the labels, a bit. Let me know if you have questions.
RCPDesign
Hello Williams
Thank you for this new version of the report.
Now the y-axis is ok, but I lost the values ??inside the series.
Is it possible to have data values ??in the series with a y-axis coherent?
(Please see attachment)
Thank you in advance
mwilliams
I get the "desired output" output when I run the report. How are you running the report?
mwilliams
I even re-downloaded the example I posted in here, last, to be sure it worked correctly and I get the same. I see the 3rd image as my output.
RCPDesign
I'm running the report in BIRT Report viewer directly in report designer (see attachement)
I'm using version 3.7.0
I also testing the report in version 3.7.2 but I always obtain the second image as output (with y-axis ok and values inbside the series all 0%)
mwilliams
Weird. Can you attach the report you're using? Maybe it got changed somehow.
RCPDesign
here is the report I used
mwilliams
Here's the output I get, running the report you attached. It's correct in all outputs.