<?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>topic Re: Dynamic Aggregations based on positive/negative signs in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-Aggregations-based-on-positive-negative-signs/m-p/3745312#M146056</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="447899" data-lia-user-login="lzi" class="lia-mention lia-mention-user"&gt;lzi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following DAX may be helpful in solving your problem.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Running_Total_Table =
VAR AllAccounts = VALUES('FACT TABLE'[Account Number])
VAR AllMonths = VALUES('FACT TABLE'[Month])
VAR AllCombinations =
    ADDCOLUMNS(
        CROSSJOIN(AllAccounts, AllMonths),
        "Running Total",
        CALCULATE(
            SUM('FACT TABLE'[Amount (LCY)]),
            FILTER(
                ALL('FACT TABLE'),
                'FACT TABLE'[Account Number] = EARLIER('FACT TABLE'[Account Number]) &amp;amp;&amp;amp;
                'FACT TABLE'[Month] &amp;lt;= EARLIER('FACT TABLE'[Month])
            )
        )
    )
RETURN
    FILTER(
        AllCombinations,
        [Running Total] &amp;gt; 0
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you still have questions, please&amp;nbsp;provide detailed sample pbix file and the results you expect.So that I can help you better. Please remove any sensitive data in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jayleny&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Mar 2024 07:54:07 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-03-06T07:54:07Z</dc:date>
    <item>
      <title>Dynamic Aggregations based on positive/negative signs</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-Aggregations-based-on-positive-negative-signs/m-p/3743528#M145988</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently struggling with the following issue:&lt;/P&gt;&lt;P&gt;I have a list with account numbers and a fact table that contains the postings on the several account numbers, differentiated by different dimensions.&lt;/P&gt;&lt;P&gt;The total amount per account number is the running total of all months aggregated until the selected month, that I'm calculating with the following DAX measure:&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&amp;nbsp;CALCULATE(SUM('FACT TABLE'[Amount (LCY)]),&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;FILTER ( ALL ( 'FACT TABLE'[Month]), [Month] &amp;lt;= MAX ( 'FACT TABLE'[Month]) )))&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I firstly have to calculate the total running amount per month by account number in order to identify the sign of the value of the account in the selected month. If the sign aggregated at account level is positive, the amount should be considered as payables, if it's negative, it should be considered as receivables.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;After identifying whether the amount belongs to payables or receivables in the selected month, I have to calculate the value by dimension.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I have created a calculated table that does the aggreagtion at month and account number level, which returns a table like the following:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;The table is connected to the calendar table via month field. My problem is now, that as soon as I'm selecting januars 2024, the calendar table filters my aggregated table by month and does not return the account no in the example, as there aren't any postings in january 2024. But as I always need to calculate the running total until the selected date, I also need to show accounts, that do not have postings in the selected month, but in the past, as the total amount filtered by date &amp;lt;= selected date is greater than 0.&lt;/P&gt;&lt;P&gt;How can I solve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 05 Mar 2024 14:54:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-Aggregations-based-on-positive-negative-signs/m-p/3743528#M145988</guid>
      <dc:creator>lzi</dc:creator>
      <dc:date>2024-03-05T14:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Aggregations based on positive/negative signs</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-Aggregations-based-on-positive-negative-signs/m-p/3745312#M146056</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="447899" data-lia-user-login="lzi" class="lia-mention lia-mention-user"&gt;lzi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following DAX may be helpful in solving your problem.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Running_Total_Table =
VAR AllAccounts = VALUES('FACT TABLE'[Account Number])
VAR AllMonths = VALUES('FACT TABLE'[Month])
VAR AllCombinations =
    ADDCOLUMNS(
        CROSSJOIN(AllAccounts, AllMonths),
        "Running Total",
        CALCULATE(
            SUM('FACT TABLE'[Amount (LCY)]),
            FILTER(
                ALL('FACT TABLE'),
                'FACT TABLE'[Account Number] = EARLIER('FACT TABLE'[Account Number]) &amp;amp;&amp;amp;
                'FACT TABLE'[Month] &amp;lt;= EARLIER('FACT TABLE'[Month])
            )
        )
    )
RETURN
    FILTER(
        AllCombinations,
        [Running Total] &amp;gt; 0
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you still have questions, please&amp;nbsp;provide detailed sample pbix file and the results you expect.So that I can help you better. Please remove any sensitive data in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jayleny&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 07:54:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-Aggregations-based-on-positive-negative-signs/m-p/3745312#M146056</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-06T07:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Aggregations based on positive/negative signs</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-Aggregations-based-on-positive-negative-signs/m-p/3745906#M146085</link>
      <description>&lt;P&gt;Thanks Jayleny, this helped A LOT!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 11:41:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-Aggregations-based-on-positive-negative-signs/m-p/3745906#M146085</guid>
      <dc:creator>lzi</dc:creator>
      <dc:date>2024-03-06T11:41:21Z</dc:date>
    </item>
  </channel>
</rss>

