How to sum up a dynamic table with Evaluate data based on different List Options?

Purpose

With the use of both Reporting and Scaffolding add-ons, we can evaluate the data based on the selected List Options.

Solution

Paste the following Storage Format example into your source code editor.

Storage Format
<ac:structured-macro ac:macro-id="d61e14ff-e55c-4440-acd2-b92f945897fc" ac:name="table-data" ac:schema-version="1">
  <ac:parameter ac:name="name">table1</ac:parameter>
  <ac:rich-text-body>
    <table class="wrapped" style="margin-left: 30.0px;">
      <colgroup>
        <col style="width: 248.0px;"/>
        <col style="width: 248.0px;"/>
        <col/>
      </colgroup>
      <tbody>
        <tr>
          <th>Name</th>
          <th>Price</th>
          <th colspan="1">Type</th>
        </tr>
        <tr>
          <td>
            <div class="content-wrapper">
              <ac:structured-macro ac:macro-id="383298b4-b297-4a79-a52f-093320338bbf" ac:name="text-data" ac:schema-version="1">
                <ac:parameter ac:name="name">name</ac:parameter>
                <ac:parameter ac:name="content">text</ac:parameter>
                <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
                <ac:rich-text-body>
                  <p>
                    <br/>
                  </p>
                </ac:rich-text-body>
              </ac:structured-macro>
            </div>
          </td>
          <td>
            <div class="content-wrapper">
              <ac:structured-macro ac:macro-id="baafed94-427c-47b5-910c-3e9f6526b877" ac:name="number-data" ac:schema-version="1">
                <ac:parameter ac:name="name">number</ac:parameter>
                <ac:parameter ac:name="required">true</ac:parameter>
                <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
              </ac:structured-macro>
            </div>
          </td>
          <td colspan="1">
            <div class="content-wrapper">
              <ac:structured-macro ac:macro-id="e7028d93-bf99-4ed2-9daf-b2e8e0344a81" ac:name="list-data" ac:schema-version="1">
                <ac:parameter ac:name="name">Total</ac:parameter>
                <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
                <ac:rich-text-body>
                  <ac:structured-macro ac:macro-id="7383ada3-21fd-4a59-a71f-3219cfa5cf70" ac:name="list-option" ac:schema-version="1">
                    <ac:parameter ac:name="value">dealer1</ac:parameter>
                    <ac:rich-text-body>
                      <p>Dealership 1</p>
                    </ac:rich-text-body>
                  </ac:structured-macro>
                  <ac:structured-macro ac:macro-id="100b0a56-f8c5-43da-971e-90ea2179a998" ac:name="list-option" ac:schema-version="1">
                    <ac:parameter ac:name="value">dealer2</ac:parameter>
                    <ac:rich-text-body>
                      <p>Dealership 2</p>
                    </ac:rich-text-body>
                  </ac:structured-macro>
                </ac:rich-text-body>
              </ac:structured-macro>
            </div>
          </td>
        </tr>
      </tbody>
    </table>
  </ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="a3be4f18-0ce5-4d3e-b30f-72c25017cea6" ac:name="report-table" ac:schema-version="1">
  <ac:parameter ac:name="injected">true</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="fed42fba-fa14-44e9-9857-25d6525f1a4b" ac:name="grouping-reporter" ac:schema-version="1">
      <ac:parameter ac:name="as">first,second</ac:parameter>
      <ac:parameter ac:name="">data:Total&gt;first,data:Total&gt;second</ac:parameter>
      <ac:rich-text-body>
        <p>
          <ac:structured-macro ac:macro-id="1ec70420-b2c4-41fe-b656-0b8b7b0efc8d" ac:name="grouping-stats" ac:schema-version="1">
            <ac:parameter ac:name="as">number</ac:parameter>
            <ac:parameter ac:name="">data:number</ac:parameter>
          </ac:structured-macro>
        </p>
        <ac:structured-macro ac:macro-id="dc6d5023-55ae-46a7-8eed-26ea781b1011" ac:name="local-reporter" ac:schema-version="1">
          <ac:parameter ac:name="">data:table1</ac:parameter>
          <ac:rich-text-body>
            <p>
              <ac:structured-macro ac:macro-id="0047f759-a9b7-484a-9be9-2a1d9c0422cc" ac:name="text-filter" ac:schema-version="1">
                <ac:parameter ac:name="value">dealer1</ac:parameter>
                <ac:parameter ac:name="">data:Total&gt;first</ac:parameter>
              </ac:structured-macro>
            </p>
          </ac:rich-text-body>
        </ac:structured-macro>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="b780254e-dda7-4436-9ae8-67e092724fb9" ac:name="report-column" ac:schema-version="1">
      <ac:parameter ac:name="injected">true</ac:parameter>
      <ac:parameter ac:name="title">Dealer 1 Sum</ac:parameter>
      <ac:rich-text-body>
        <p>
          <ac:structured-macro ac:macro-id="b4ce0962-4cec-4a77-8fd2-dc095338b602" ac:name="report-info" ac:schema-version="1">
            <ac:parameter ac:name="">grouped:number&gt; stats:sum</ac:parameter>
          </ac:structured-macro>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
  </ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="02d2431c-9ec4-4d0b-ac9d-f4db98afc946" ac:name="report-table" ac:schema-version="1">
  <ac:parameter ac:name="injected">true</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="2781ecc9-7138-4a1d-9898-81134020b3cc" ac:name="grouping-reporter" ac:schema-version="1">
      <ac:parameter ac:name="as">first,second</ac:parameter>
      <ac:parameter ac:name="">data:Total&gt;first,data:Total&gt;second</ac:parameter>
      <ac:rich-text-body>
        <p>
          <ac:structured-macro ac:macro-id="a9da3167-f761-4870-86f0-c1bca6427846" ac:name="grouping-stats" ac:schema-version="1">
            <ac:parameter ac:name="as">number</ac:parameter>
            <ac:parameter ac:name="">data:number</ac:parameter>
          </ac:structured-macro>
        </p>
        <ac:structured-macro ac:macro-id="70fd31d8-c813-42f6-b74d-f9392c77d033" ac:name="local-reporter" ac:schema-version="1">
          <ac:parameter ac:name="">data:table1</ac:parameter>
          <ac:rich-text-body>
            <p>
              <ac:structured-macro ac:macro-id="fed2e3b3-a5be-49d6-8916-5451c1360805" ac:name="text-filter" ac:schema-version="1">
                <ac:parameter ac:name="value">dealer2</ac:parameter>
                <ac:parameter ac:name="">data:Total&gt;first</ac:parameter>
              </ac:structured-macro>
            </p>
          </ac:rich-text-body>
        </ac:structured-macro>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="39aeb1b4-19ad-4c1e-bf77-841b99dc05df" ac:name="report-column" ac:schema-version="1">
      <ac:parameter ac:name="title">Dealer 2 Sum</ac:parameter>
      <ac:rich-text-body>
        <p>
          <ac:structured-macro ac:macro-id="6c0d9b8d-a5d6-4cf8-9e6d-003d56fa16ba" ac:name="report-info" ac:schema-version="1">
            <ac:parameter ac:name="">grouped:number&gt; stats:sum</ac:parameter>
          </ac:structured-macro>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
  </ac:rich-text-body>
</ac:structured-macro>