Use eval-data macro to sum based on a specific column value
II would like to sum a number using the eval-data macro in one table based on the values in another table. The issue I have is I want the eval-data macro to only include values based on the value of another column.
In the example below, I have a table called “Days Earned”. The second table is called “PTO Details” with one column called DaysUsed and another called PTOEmp.
Is there a way I can use in the eval-data macro in “Days Earned” but only sum DaysUsed when Days Earned:Employee=PTO Details:PTOEmp. Basically this would allow me to total the days used by each employee and show that number in another table.
{noformat}
{table-data:Days Earned}
|| Employee|| Start Date || Day Earned || Days Carried Over ||
| {list-data:Employee|required=true}
{user-options:groups=confluence-users|sort=ascending} {list-data} | {date-data:StartDate|format=MMM-dd-yyyy}{date-data} | {number-data:DaysEarned}17{number-data}| {number-data:DaysCarOver}0{number-data}|
{table-data}
{table-data:PTO Details}
|| Employee|| PTO Date || Reason|| Days Used ||
| {list-data:PTOEmp|required=true}{user-options:groups=confluence-users} {list-data} | {date-data:PTO Date|format=MMM-dd-yyyy}today{date-data} | {list-data:Status}{list-option}Sick Day{list-option}
{list-option}PTO Day{list-option}{list-data} | {number-data:DaysUsed}1{number-data}|
{table-data}
{noformat}
In the example below, I have a table called “Days Earned”. The second table is called “PTO Details” with one column called DaysUsed and another called PTOEmp.
Is there a way I can use in the eval-data macro in “Days Earned” but only sum DaysUsed when Days Earned:Employee=PTO Details:PTOEmp. Basically this would allow me to total the days used by each employee and show that number in another table.
{noformat}
{table-data:Days Earned}
|| Employee|| Start Date || Day Earned || Days Carried Over ||
| {list-data:Employee|required=true}
{user-options:groups=confluence-users|sort=ascending} {list-data} | {date-data:StartDate|format=MMM-dd-yyyy}{date-data} | {number-data:DaysEarned}17{number-data}| {number-data:DaysCarOver}0{number-data}|
{table-data}
{table-data:PTO Details}
|| Employee|| PTO Date || Reason|| Days Used ||
| {list-data:PTOEmp|required=true}{user-options:groups=confluence-users} {list-data} | {date-data:PTO Date|format=MMM-dd-yyyy}today{date-data} | {list-data:Status}{list-option}Sick Day{list-option}
{list-option}PTO Day{list-option}{list-data} | {number-data:DaysUsed}1{number-data}|
{table-data}
{noformat}
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
-
Inappropriate?Hmm. This gets tricky, since Reporting/Scaffolding don't really support 'join' operations as yet. What you really need here is to be able to do a join on a group-by report. I can give you the grouping-reporter examples to sum up each table individually, but I can't think of a way to link the two results together currently.
h2. Days Earned per Employee
{report-table}
{grouping-reporter:data:Employee|as=Employee}
{grouping-stats:data:DaysEarned|as=DaysEarned}
{local-reporter:data:Days Earned}
{grouping-reporter}
{report-column:title=Employee}{report-info:grouped:Employee}{report-column}
{report-column:title=Total Days Earned}{report-info:grouped:DaysEarned > stats:sum}{report-column}
{report-table}
h2. Days Used per Employee
{report-table}
{grouping-reporter:data:PTOEmp|as=Employee}
{grouping-stats:data:DaysUsed|as=DaysUsed}
{local-reporter:data:PTO Details}
{grouping-reporter}
{report-column:title=Employee}{report-info:grouped:Employee}{report-column}
{report-column:title=Total Days Used}{report-info:grouped:DaysUsed > stats:sum}{report-column}
{report-table}
Hopefully that helps a bit anyway... -
Inappropriate?I will try the grouping you have suggested and hopefully figure out a work around. Thanks for your response!
Loading Profile...



EMPLOYEE