# Reporting Module - Nesting a Summary Table that Repeats Each Ingredient

**URL:** <https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597>\
**Category:** Ignition\
**Tags:** reporting\
**Created:** [August 11, 2025, 5:04pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597 "2025-08-11T17:04:32Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Meyer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/eric_meyer/32/72323_2.png) [@Eric\_Meyer](https://forum.inductiveautomation.com/u/Eric_Meyer)\
**Post date:** [August 11, 2025, 5:04pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597/1 "2025-08-11T17:04:32Z")

</div>

Hi all –

I’m working on a production report for a client and I’m running into a challenge with campaign-level summaries.

**Context**

- Main data source is a **Named Query** (MainQueryDetails) that returns all fields I need: Work Order, Campaign, Product, Line, Batch Number, Ingredient, Target, Actual, etc.

- My grouping hierarchy in the report:

**Current Behavior**

- Each **batch** group lists all ingredients and their amounts.

- A batch group footer calculates **per-batch ingredient totals** (works fine).

- The **Campaign** group footer can show a **single aggregated record** (total usage for all ingredients combined), but not **multiple rows per ingredient**.

**Goal**  
After each campaign, I would like a **summary table** that:

- Lists **each ingredient used in that campaign**.

- Shows the **sum of Target** and **sum of Actual** for that ingredient across _all batches_ in the campaign.

What I am trying to accomplish is the highlighted summary of each campaign in the attached mockup. I currently have all the other parts working with a single table group and then grouping previously mentioned.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/b/0bc208af4c8afb567fc3c558b186d65be353b7f2.png)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 11, 2025, 5:33pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597/2 "2025-08-11T17:33:09Z")

</div>

First thing I would ask, why not add `sum target` and `sum actual` columns to the batch groupings. You already have the ingredients listed there, why repeat those lines again?

Edit: I missed the part where the sums include all batches under a campaign, but I think it could still work. Can you supply an example dataset?

---

<div class="post-metadata">

**Author:** ![Eric\_Meyer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/eric_meyer/32/72323_2.png) [@Eric\_Meyer](https://forum.inductiveautomation.com/u/Eric_Meyer)\
**Post date:** [August 11, 2025, 6:22pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597/3 "2025-08-11T18:22:29Z")

</div>

It would look something like this with multiple shop orders and campaigns present. Like I said, I can put a summary row on the campaign group which totals all ingredients for the entire campaign, but I can’t detail out the campaigns totals for each ingredient. I can always add another table at the end of the report that has totals of each ingredient grouped by campaign only, but I was trying to make the report more streamlined.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/e/5e7f64da3f08ad4e09c4506bd35fa4a50476d9ad.png)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 11, 2025, 7:19pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597/4 "2025-08-11T19:19:02Z")

</div>

Can you post a csv or something that I can copy/paste?

---

<div class="post-metadata">

**Author:** ![Eric\_Meyer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/eric_meyer/32/72323_2.png) [@Eric\_Meyer](https://forum.inductiveautomation.com/u/Eric_Meyer)\
**Post date:** [August 11, 2025, 7:21pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597/5 "2025-08-11T19:21:27Z")

</div>

[export.csv](https://forum.inductiveautomation.com/uploads/short-url/1fM2M3aHoLQbmmNDMXw0oenSe8k.csv) (1.7 KB)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 11, 2025, 8:41pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597/6 "2025-08-11T20:41:48Z")

</div>

I see what you mean by not being able to get multiple rows for your ingredient summation lines.

I think the only way you can do this is to add the summary for the appropriate group (line I think), then make that row _unstructured_. Then you can add another table inside that summary row to get multiple lines. Note that the space used for this row won’t be dynamic in height.

You’ll have to figure out how to manipulate your data, or add window functions to your query, and or subquery your data to get the ingredient totals you need to populate the tables.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/1/a157e36c0dcc8e44c596f630128034cc15bdf0fb.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/8/c8c7c34f5bb98a71f8e69a9d5755f6b953f257f8.png)

---

<div class="post-metadata">

**Author:** ![Eric\_Meyer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/eric_meyer/32/72323_2.png) [@Eric\_Meyer](https://forum.inductiveautomation.com/u/Eric_Meyer)\
**Post date:** [August 14, 2025, 1:12pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597/7 "2025-08-14T13:12:04Z")

</div>

Hey Daniel,

Thanks for sharing this info. I wanted to give an update on my progress. I tried the nested table approach you suggested, and I thought it was going to work, but I couldn’t quite get it to completely work.

I nested a table inside the campaign group’s summary row and pointed it to the same dataset. Then I grouped that nested table by ingredient, which does correctly summarize and list each ingredient’s target and actual values.

The issue is that it repeats every campaign’s ingredient summary for each campaign, instead of only showing the ingredient summary for the campaign it’s nested under. I had assumed the initial campaign grouping would automatically limit the nested table’s data, but that isn’t the case.

I also tried creating a nested query specifically for that nested table, but haven’t had much luck with it yet.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [August 14, 2025, 2:01pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597/8 "2025-08-14T14:01:56Z")

</div>

I would either add another query to the data source that sums up the totals for the ingredients by campaign and work order, or do a scripted data source and do it manually in a loop.

---

<div class="post-metadata">

**Author:** ![Eric\_Meyer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/eric_meyer/32/72323_2.png) [@Eric\_Meyer](https://forum.inductiveautomation.com/u/Eric_Meyer)\
**Post date:** [August 14, 2025, 2:12pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597/9 "2025-08-14T14:12:51Z")

</div>

I thought about another query that does totals by campaign (this is easy to do), but how does the nested table know not to list all the campaign’s ingredient totals after each main table’s grouped campaign?

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [August 14, 2025, 2:17pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597/10 "2025-08-14T14:17:43Z")

</div>

Put it in the campaign footer?

---

<div class="post-metadata">

**Author:** ![Eric\_Meyer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/eric_meyer/32/72323_2.png) [@Eric\_Meyer](https://forum.inductiveautomation.com/u/Eric_Meyer)\
**Post date:** [August 14, 2025, 4:34pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597/11 "2025-08-14T16:34:37Z")

</div>

I believe this what I tried previously. The nested table doesn’t know to only show summed ingredients for the campaign group it is in.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [August 14, 2025, 5:30pm UTC](https://forum.inductiveautomation.com/t/reporting-module-nesting-a-summary-table-that-repeats-each-ingredient/109597/12 "2025-08-14T17:30:54Z")

</div>

Without seeing the actual data sources for the report, but if you do an actual subquery in the data sources that is linked by campaign, it should then be nested right into the tables based off of campaign ID?

Off the top of my head, no designer open at the moment but.

The subquery just doing a sum of ingredients for the campaign grouped by however deep you want to go with it.

`SELECT [Campaign],[Product],[Line],[Ingredient], SUM(Actual) as TTL`  
`FROM MainTable`  
`WHERE Campaign = ?`  
`GROUP BY [Campaign],[Product],[Line]`

And link the parameter to {Campaign}
