Seal Report Forum
»
Report Edition
»
Reports
»
Total Percent from Total Sums
Rank: Newbie
Groups: Registered
Joined: 8/31/2021(UTC) Posts: 3
|
Hello,
I´m new at SealReport. I've successfully built some reports, but I stuck at the Total Percent.
I want to have the percentage of the values of the Total-Line, not a sum or average from the percentage column.
Does anyone has an idea to solve this?
Thx Markus
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
If you are using the calculation options to get the percentage of the Totals columns is not a sum or average, it is calculated with the total values. In attachement is a sample report having a task that again performs the calculation on the result table, you can check that the values are the same is you enable or disable the task... Calculation.srex (7kb) downloaded 13 time(s).
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 8/31/2021(UTC) Posts: 3
|
Hi and thanks for the fast answer! Hmm, this sample i´ve seen already. But i want to do something like this:
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
I have enhanced the sample 13 to calculate the difference in % It is done in the Cell Script of the Amount element: Code:@{
//Calculate the diffence in %
ResultCell cell=Model;
ReportElement element = cell.Element;
ReportModel reportModel = element.Model;
Report report = reportModel.Report;
if (!cell.IsTitle && cell.IsTotal && cell.ContextRow > 0 && cell.ContextCol == 3)
{
var value1 = cell.ContextTable[cell.ContextRow,cell.ContextCol-2].DoubleValue;
var value2 = cell.ContextTable[cell.ContextRow,cell.ContextCol-1].DoubleValue;
if (value1 != null && value2 != null) {
cell.FinalValue = string.Format("{0:N2} %", 100*(value2 - value1)/value1);
if (value2 - value1 < 0)
{
cell.FinalCssStyle = "font-weight:bold;color:red";
}
}
else {
cell.Value = null;
}
}
if (cell.ContextRow == 0 && cell.IsTitle && cell.IsTotal)
{
cell.Value = "Difference";
}
}
You may adapt this for your report. 13-Sales comparison per month.srex (9kb) downloaded 3 time(s).
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 8/31/2021(UTC) Posts: 3
|
Thats it! Learned a lot.
Thank you so much!
|
|
|
|
Seal Report Forum
»
Report Edition
»
Reports
»
Total Percent from Total Sums
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.