<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: SAC Data Action: Advanced Formula aggregation issue, values summing up in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/sac-data-action-advanced-formula-aggregation-issue-values-summing-up/qaa-p/14465795#M4947657</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/2280916"&gt;@Hoppeno&lt;/a&gt;&lt;/P&gt;&lt;DIV&gt;When using "Write Higher Value into the Target Measure Tatsächlicher Erlös," is the value written at the aggregated level of the Profit Centers / Contracts dimension, or is it written to the leaf-level members?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Moonjun&lt;/DIV&gt;</description>
    <pubDate>Tue, 18 Aug 2026 02:45:04 GMT</pubDate>
    <dc:creator>MoonJun</dc:creator>
    <dc:date>2026-08-18T02:45:04Z</dc:date>
    <item>
      <title>SAC Data Action: Advanced Formula aggregation issue, values summing up</title>
      <link>https://community.sap.com/t5/technology-q-a/sac-data-action-advanced-formula-aggregation-issue-values-summing-up/qaq-p/14457496</link>
      <description>&lt;P&gt;Dear Community, i am facing an issue with a SAC Data Action using Advanced Formulas for revenue calculation.&lt;/P&gt;&lt;P&gt;I want to compare two measures with the names "Umsatzmiete_VZ" and "Umsatzmiete" for a list of shops and write the higher value into the target measure "Tatsächlicher Erlös".&amp;nbsp;When using a standard IF-ELSE statement, instead of picking the higher value, SAC evaluates the condition line-by-line across different underlying dimensions (e.g., Profit Centers / Contracts) and ends up **adding/summing up** the values into `Tatsaechlicher_Erloes`.&lt;/P&gt;&lt;P&gt;Code Snippet:&amp;nbsp;&lt;/P&gt;&lt;P&gt;// 1. Target definition&lt;BR /&gt;MEMBERSET [d/Measures] = "Tatsaechlicher_Erloes"&lt;BR /&gt;MEMBERSET [d/Datum] = BASEMEMBER([d/Datum].[h/YQM], %Planjahr%)&lt;BR /&gt;MEMBERSET [d/Shopbezeichnung] = "Binder Optik GmbH"&lt;/P&gt;&lt;P&gt;// 2. Vectorial IF-ELSE Logic (causes aggregation/summing issue)&lt;BR /&gt;IF RESULTLOOKUP([d/Measures] = "Umsatzmiete_VZ") &amp;gt;= RESULTLOOKUP([d/Measures] = "Umsatzmiete") THEN&lt;BR /&gt;DATA() = RESULTLOOKUP([d/Measures] = "Umsatzmiete_VZ")&lt;BR /&gt;ELSE&lt;BR /&gt;DATA() = RESULTLOOKUP([d/Measures] = "Umsatzmiete")&lt;BR /&gt;ENDIF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I perform a proper aggregated comparison between two measures without running into summing up values improperly?&lt;/P&gt;&lt;P&gt;Any help or best practices would be greatly appreciated!&lt;/P&gt;&lt;P&gt;Best regards, Nico&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hoppeno_0-1785997943640.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/442374i485A01ED5B8FCECC/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Hoppeno_0-1785997943640.png" alt="Hoppeno_0-1785997943640.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hoppeno_1-1785997953686.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/442375i62406C7437CBDF12/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Hoppeno_1-1785997953686.png" alt="Hoppeno_1-1785997953686.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2026 06:34:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sac-data-action-advanced-formula-aggregation-issue-values-summing-up/qaq-p/14457496</guid>
      <dc:creator>Hoppeno</dc:creator>
      <dc:date>2026-08-06T06:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAC Data Action: Advanced Formula aggregation issue,...</title>
      <link>https://community.sap.com/t5/technology-q-a/sac-data-action-advanced-formula-aggregation-issue-values-summing-up/qaa-p/14461351#M4947394</link>
      <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/2280916"&gt;@Hoppeno&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;The summing happens because Advanced Formulas calculates at leaf level for any dimension you haven't explicitly restricted or aggregated (e.g. Profit Center, Contract). So your IF/RESULTLOOKUP comparison isn't running once per shop, it's running separately for every Profit Center/Contract combination, and each of those writes its own result.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try fixing it with adding Aggregate_dimensions / Aggregate_writeto - this helps us to aggregate those dimensions before comparing and write the single result to one member instead of each leaf.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vinay_009_0-1786451624842.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/444682iD72B319E4F22E7ED/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="vinay_009_0-1786451624842.png" alt="vinay_009_0-1786451624842.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Swap in whatever dimensions your model has that aren't already set in a MEMBERSET. If you skip one, it still gets calculated leaf by leaf, causing the same summing issue. Once you aggregate it properly, the comparison works on the totals , so it picks the higher value instead of adding everything together.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinay&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2026 12:41:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sac-data-action-advanced-formula-aggregation-issue-values-summing-up/qaa-p/14461351#M4947394</guid>
      <dc:creator>vinay_009</dc:creator>
      <dc:date>2026-08-11T12:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAC Data Action: Advanced Formula aggregation issue, values summing up</title>
      <link>https://community.sap.com/t5/technology-q-a/sac-data-action-advanced-formula-aggregation-issue-values-summing-up/qaa-p/14465795#M4947657</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/2280916"&gt;@Hoppeno&lt;/a&gt;&lt;/P&gt;&lt;DIV&gt;When using "Write Higher Value into the Target Measure Tatsächlicher Erlös," is the value written at the aggregated level of the Profit Centers / Contracts dimension, or is it written to the leaf-level members?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Moonjun&lt;/DIV&gt;</description>
      <pubDate>Tue, 18 Aug 2026 02:45:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sac-data-action-advanced-formula-aggregation-issue-values-summing-up/qaa-p/14465795#M4947657</guid>
      <dc:creator>MoonJun</dc:creator>
      <dc:date>2026-08-18T02:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAC Data Action: Advanced Formula aggregation issue,...</title>
      <link>https://community.sap.com/t5/technology-q-a/sac-data-action-advanced-formula-aggregation-issue-values-summing-up/qaa-p/14469243#M4947870</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/2280916"&gt;@Hoppeno&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the Profit Center and Contract dimensions, use Variable Members to perform the aggregation. Then, compare the temporary values stored in the Variable Members to derive the desired result. Please refer to the Advanced Formulas script below.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;MEMBERSET [d/Measures] = "Tatsaechlicher_Erloes"
MEMBERSET [d/Datum] = BASEMEMBER([d/Datum].[h/YQM], %Planjahr%)
MEMBERSET [d/Shopbezeichnung] = "Binder Optik GmbH"

VARIABLEMEMBER #V_Umsatzmiete_VZ OF [d/Measures]
VARIABLEMEMBER #V_Umsatzmiete OF [d/Measures]

DATA([d/Measures] = #V_Umsatzmiete_VZ, [d/Profit_Centers] = "#", [d/Contracts] = "#") = RESULTLOOKUP([d/Measures] = "Umsatzmiete_VZ")
DATA([d/Measures] = #V_Umsatzmiete, [d/Profit_Centers] = "#", [d/Contracts] = "#") = RESULTLOOKUP([d/Measures] = "Umsatzmiete")

IF RESULTLOOKUP([d/Measures] = #V_Umsatzmiete_VZ, [d/Profit_Centers] = "#", [d/Contracts] = "#")
	- RESULTLOOKUP([d/Measures] = #V_Umsatzmiete, [d/Profit_Centers] = "#", [d/Contracts] = "#") &amp;gt;= 0 THEN
	DATA() = RESULTLOOKUP([d/Measures] = "Umsatzmiete_VZ")
ELSE
	DATA() = RESULTLOOKUP([d/Measures] = "Umsatzmiete")
ENDIF&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this is helpful to you, and if I have misunderstood anything, please feel free to reach out.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Moonjun&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2026 10:52:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sac-data-action-advanced-formula-aggregation-issue-values-summing-up/qaa-p/14469243#M4947870</guid>
      <dc:creator>MoonJun</dc:creator>
      <dc:date>2026-08-21T10:52:28Z</dc:date>
    </item>
  </channel>
</rss>

