<?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: Semi-additive max date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2250686#M54171</link>
    <description>&lt;P&gt;This was so helpful! Thank you very much.&lt;/P&gt;&lt;P&gt;I get correct Count but not correct month.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Count is now shown when the change was made. I wan't it to show in the month of the EndDate.&lt;/P&gt;&lt;P&gt;Not realy sure if i should try to change te linage somewhere in the end or if the change should be made in the base.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Date Table is related to ChangeDate.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Dec 2021 20:47:26 GMT</pubDate>
    <dc:creator>Bian</dc:creator>
    <dc:date>2021-12-21T20:47:26Z</dc:date>
    <item>
      <title>Semi-additive max date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2248493#M54030</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used Alberto and Marcos DAX pattern for Semi-additive calculations&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.daxpatterns.com/semi-additive-calculations/" target="_blank" rel="noopener"&gt;Semi-additive calculations – DAX Patterns&lt;/A&gt;&lt;BR /&gt;Primaraly the DAX code to calculate Balance per customer.&lt;/P&gt;&lt;P&gt;I need to add complexity but dont really know how.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to add Product and another date column: EndDate. (The last date the customer can use that product).&lt;/P&gt;&lt;P&gt;I would now like to find the last Balance[Date] for each Product per customer. And from that list find the last EndDate for the Customer.&lt;BR /&gt;From that information would I then need to calculate how many customers with an EndDate in that particular month.&lt;/P&gt;&lt;P&gt;Thats my goal: Lost Customers per month&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can i nestle another calculatetable in the first one?&lt;/P&gt;&lt;P&gt;Do I repeat the first variables with EndDate instead?&lt;/P&gt;&lt;P&gt;Is it possible to solve in the filter section of the Calculate(Max()?&lt;BR /&gt;&lt;BR /&gt;Example from Alberto and Marcos:&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;DIV class="line number1 index0 alt2 highlighted"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Balance LastDateByCustomer :=
VAR MaxBalanceDates =
    ADDCOLUMNS (
        SUMMARIZE (            -- Retrieves the customers
            Balances,          -- from the Balances table
            Customers[Name]
        ),
        "@MaxBalanceDate", CALCULATE (     -- Computes for each customer
            MAX ( Balances[Date] )         -- their last date 
        )
    )
VAR MaxBalanceDatesWithLineage =
    TREATAS (                  -- Changes the lineage of MaxBalanceDates
        MaxBalanceDates,       -- so to make it filter
        Customers[Name],       -- the customer name
        'Date'[Date]           -- and the date
    )
VAR Result =
    CALCULATE (
        SUM ( Balances[Balance] ),
        MaxBalanceDatesWithLineage
    )
RETURN
    Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The EndDate can change so a later change can set the EndDate to earlier than before. It's therefore not possible to just look att max endDate.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 21:29:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2248493#M54030</guid>
      <dc:creator>Bian</dc:creator>
      <dc:date>2021-12-20T21:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: Semi-additive max date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2248524#M54036</link>
      <description>&lt;P&gt;Can you give some example data and desired output? It's hard to follow exactly what you're asking for in the abstract.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 21:51:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2248524#M54036</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-12-20T21:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Semi-additive max date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2250412#M54142</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Allright so here is an example from the table&lt;/P&gt;&lt;P&gt;So its a Subscription model and this is the stat-table holding all changes to every subscription. It's currently around 400K rows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;ChangeDate&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;CustomerID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;SubscriptionID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;ProductID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;StartDate&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;EndDate&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01-01-2021&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;55&lt;/TD&gt;&lt;TD&gt;01-01-2009&lt;/TD&gt;&lt;TD&gt;10-30-2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;02-10-2021&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;55&lt;/TD&gt;&lt;TD&gt;01-01-2009&lt;/TD&gt;&lt;TD&gt;10-30-2022&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10-12-2021&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;55&lt;/TD&gt;&lt;TD&gt;01-01-2009&lt;/TD&gt;&lt;TD&gt;10-30-2021&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wan't to calculate Total Customers with an EndDate in every month. But I only wan't the last change.&lt;BR /&gt;Above example should amount to 1 customer in october 2021.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Grateful for any assistance&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 16:20:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2250412#M54142</guid>
      <dc:creator>Bian</dc:creator>
      <dc:date>2021-12-21T16:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Semi-additive max date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2250562#M54159</link>
      <description>&lt;P&gt;So something like this?&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Customers Lost =
VAR EndDate = DATE ( 10, 30, 2021 ) // Or from filter context
VAR MaxChangeDates =
    ADDCOLUMNS (
        SUMMARIZE ( Subscription, Customers[Name] ),
        "@MaxChangeDate", CALCULATE ( MAX ( Subscription[ChangeDate] ) )
    )
VAR AddEndDateCol =
    ADDCOLUMNS (
        MaxChangeDates,
        "@MaxEndDate",
            CALCULATE (
                MAX ( Subscription[EndDate] ),
                TREATAS ( { @MaxChangeDate }, 'Date'[Date] )
            )
    )
RETURN
    COUNTROWS ( FILTER ( AddEndDateCol, [@MaxEndDate] = EndDate ) )&lt;/LI-CODE&gt;
&lt;P&gt;( ^^ Not tested but hopefully gives an idea for the logic, at least.)&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 18:10:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2250562#M54159</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-12-21T18:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: Semi-additive max date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2250686#M54171</link>
      <description>&lt;P&gt;This was so helpful! Thank you very much.&lt;/P&gt;&lt;P&gt;I get correct Count but not correct month.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Count is now shown when the change was made. I wan't it to show in the month of the EndDate.&lt;/P&gt;&lt;P&gt;Not realy sure if i should try to change te linage somewhere in the end or if the change should be made in the base.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Date Table is related to ChangeDate.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 20:47:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2250686#M54171</guid>
      <dc:creator>Bian</dc:creator>
      <dc:date>2021-12-21T20:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: Semi-additive max date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2250693#M54173</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="49927" data-lia-user-login="Bian" class="lia-mention lia-mention-user"&gt;Bian&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I get correct Count but not correct month.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What does this mean? I didn't write a measure to return a month.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 20:56:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2250693#M54173</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-12-21T20:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Semi-additive max date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2250695#M54174</link>
      <description>&lt;P&gt;True, I will mark this as complete and be forever greatful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Anyway you solved my main issue. Many thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 21:01:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Semi-additive-max-date/m-p/2250695#M54174</guid>
      <dc:creator>Bian</dc:creator>
      <dc:date>2021-12-21T21:01:09Z</dc:date>
    </item>
  </channel>
</rss>

