<?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: Summing YTD total acquisitions based on a new customer definition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2665115#M79171</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="389676" data-lia-user-login="Stoned_Edge10" class="lia-mention lia-mention-user"&gt;Stoned_Edge10&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, when I say "sequential identifier of the weks", it means exactly that: UNIQUE IDENTIFIER. No two months can have the same number.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jul 2022 13:24:40 GMT</pubDate>
    <dc:creator>daXtreme</dc:creator>
    <dc:date>2022-07-27T13:24:40Z</dc:date>
    <item>
      <title>Summing YTD total acquisitions based on a new customer definition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2659004#M78760</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;Hi guys,&lt;BR /&gt;&lt;BR /&gt;Is there a simple way to sum up these values in a chart to get YTD, ignoring the fact that it's a measure? I just want to take the raw values displayed in the chart and then sum them up to end up with a summation&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;. This is probably a lot more complex than I am thinking, but I can't seem to get it to work without having the filters intervene.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;What I tried was this below, but it failed horribly and ended up giving me entirely different values to what I had envisioned.&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&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;LI-CODE lang="markup"&gt;New Acquisitions YTD = 
CALCULATE (
    [New Venues],
    FILTER (
        ALL ( DIM_Date ),
        'DIM_Date'[Date] &amp;lt;= MAX ( DIM_Date[Date] )
    )
)&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;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Here is how I am calculating the number of new venues per week. It searches the table to see if the client ID existed before a 365 day prior window. If no, it counts as a new customer.&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&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;LI-CODE lang="markup"&gt;New Venues = 
VAR CustomerTM =
    VALUES ( FACT_Weekly_Actuals[ClientID] )
VAR PriorCustomers =
    CALCULATETABLE (
        VALUES ( FACT_Weekly_Actuals[ClientID] ),
        FILTER (
            ALL ( 'DIM_Date' ),
            'DIM_Date'[Date]
&amp;gt; MIN ( 'DIM_Date'[Date] ) - 365
                &amp;amp;&amp;amp; DIM_Date[Date] &amp;lt; MIN ( DIM_Date[Date] )
        )
    )
RETURN
    CALCULATE (
        SUM( FACT_Weekly_Actuals[Value] ),
        FILTER (
            FACT_Weekly_Actuals,
            FACT_Weekly_Actuals[ClientID] IN EXCEPT ( CustomerTM, PriorCustomers )
        )&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;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;BR /&gt;I want to visualize 1 + 4 + 2 + 5 + 2 + 16 + ... + n in a simple chart, that shows the YTD total acquisitions we have seen thus far this year. Is it simple or am I overlooking something?&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Appreciate your help!&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 25 Jul 2022 11:23:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2659004#M78760</guid>
      <dc:creator>Stoned_Edge10</dc:creator>
      <dc:date>2022-07-25T11:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Summing YTD total acquisitions based on a new customer definition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2659081#M78763</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="389676" data-lia-user-login="Stoned_Edge10" class="lia-mention lia-mention-user"&gt;Stoned_Edge10&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your problem stems from the fact that when you calculate new customers in some period of time, say 1 week, it'll in general not be the same as calculating new customers over any subset of the period or any superset of the period. To get YTD the way you want you have to iterate the periods you have selected. Here's one way to do it:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// measure 1
[Total Value] = SUM( FACT_Weekly_Actuals[Value] )

// measure 2
// This measure applies to any time frame but you
// have to be careful when you interpret this measure
// as its value ALSO depends on the length of the
// period currently selected (hence your problems with
// YTD).
[New Venues] =
var VisibleCustomers = VALUES( FACT_Weekly_Actuals[ClientID] )
var MinDateVisible = MIN( Dim_Date[Date] )
VAR PriorCustomers =
    CALCULATETABLE(
        VALUES( FACT_Weekly_Actuals[ClientID] ),
        DATESBETWEEN(
            Dim_Date[Date],
            MinDateVisible - 1,
            MinDateVisible - 365
        ),
        // This line is redundant if
        // Dim_Date is marked as Date Table.
        ALL( Dim_Date )
    )
RETURN
    CALCULATE(
        [Total Value],
        EXCEPT(
            VisibleCustomers,
            PriorCustomers
        )
    )
    
// measure 3
// For this measure to work you have to decide
// on the granularity of periods. Let's say
// you want to have YTD and your periods are
// weeks. WeekID must be a sequential identifier
// of weeks.
[New Venues PER WEEK YTD] =
var WeeksToIterateOver =
    CALCULATETABLE(
        VALUES( Dim_Date[WeekId] ),
        DATESYTD( Dim_Date[Date] ),
        // Same remark as before applies...
        ALL( Dim_Date )
    )
var Result = 
    CALCULATE(
        SUMX(
            WeeksToIterateOver,
            [New Venues]
        ),
        REMOVEFILTERS( Dim_Date )
     )
return
    Result&lt;/LI-CODE&gt;&lt;P&gt;By the way, you should never put a full table (especially the fact table) in any filters that are then used in CALCULATE(TABLE). This is one of the worst practices and even on moderate models will lead to slow DAX, many a time to wrong results and you'll not even be able to diagnose them.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 12:02:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2659081#M78763</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-07-25T12:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Summing YTD total acquisitions based on a new customer definition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2659091#M78764</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;For YTD I recommend trying DATESYTD. Here is an example of this:&lt;BR /&gt;&lt;BR /&gt;data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(note that I have a 1:n relationship between this table and my calendar table)&lt;BR /&gt;&lt;BR /&gt;DAX:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;YTD_example = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SimpleYTD[Value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;DATESYTD&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'[Date]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;End result:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!&lt;BR /&gt;&lt;BR /&gt;My LinkedIn: &lt;A href="https://www.linkedin.com/in/n%C3%A4ttiahov-00001/" target="_blank" rel="noopener"&gt;https://www.linkedin.com/in/n%C3%A4ttiahov-00001/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 12:06:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2659091#M78764</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-07-25T12:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Summing YTD total acquisitions based on a new customer definition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2660708#M78886</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That unfortunately didn't work for me. Am I able to send you a segment of my dataset via DM for help? It's a bit hard to try and solve this problem without looking at the underlying data. My sequential week identifier is calculated in the calendar table simply by passing WEEKNUM ( Dim_Date[Date] ) into a calculated column for years 2021 and 2022, for the range of 2021/01/01 to 2022/12/31.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regardless, here is the results I get with your above formulas. The number is still far too large.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Formulas used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;New Venues YTD = 
var WeeksToIterateOver =
    CALCULATETABLE(
        VALUES( DIM_Date[WeekNumberYear]),
        DATESYTD( Dim_Date[Date] ),
        // Same remark as before applies...
        ALL( Dim_Date )
    )
var Result = 
    CALCULATE(
        SUMX(
            WeeksToIterateOver,
            [New Venues Acquisitions]
        ),
        REMOVEFILTERS( Dim_Date )
     )
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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Venues = SUM ( FACT_Weekly_Actuals[Value] ) &lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;New Venues Acquisitions = 
var VisibleCustomers = VALUES( FACT_Weekly_Actuals[ClientID] )
var MinDateVisible = MIN( Dim_Date[Date] )
VAR PriorCustomers =
    CALCULATETABLE(
        VALUES( FACT_Weekly_Actuals[ClientID] ),
        DATESBETWEEN(
            Dim_Date[Date],
            MinDateVisible - 1,
            MinDateVisible - 365
        ),
        // This line is redundant if
        // Dim_Date is marked as Date Table.
        ALL( Dim_Date )
    )
RETURN
    CALCULATE(
        [Total Venues],
        EXCEPT(
            VisibleCustomers,
            PriorCustomers
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 05:08:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2660708#M78886</guid>
      <dc:creator>Stoned_Edge10</dc:creator>
      <dc:date>2022-07-26T05:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Summing YTD total acquisitions based on a new customer definition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2661016#M78889</link>
      <description>&lt;P&gt;When you say sequential week number, do you mean that it resets after each year (i.e 52 becomes 1 or should 52 continue to 53?) If the latter, I am not sure how to generate this continuing week number calculation in DAX. Oh nice, it needed to be truly sequential (i.e 1 to n number of max weeks in the date calendar). You were right! Thanks so much!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 07:43:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2661016#M78889</guid>
      <dc:creator>Stoned_Edge10</dc:creator>
      <dc:date>2022-07-26T07:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Summing YTD total acquisitions based on a new customer definition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2665115#M79171</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="389676" data-lia-user-login="Stoned_Edge10" class="lia-mention lia-mention-user"&gt;Stoned_Edge10&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, when I say "sequential identifier of the weks", it means exactly that: UNIQUE IDENTIFIER. No two months can have the same number.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 13:24:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-YTD-total-acquisitions-based-on-a-new-customer/m-p/2665115#M79171</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-07-27T13:24:40Z</dc:date>
    </item>
  </channel>
</rss>

