<?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: New Customer count and sales calculation in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3581164#M138136</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I see, thank you for the clarification. If you want to identify customers who are new in the current year based on their entire purchase history, you should modify the measures accordingly. Here's the updated code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Customers Year =&lt;BR /&gt;VAR currentCustomers = VALUES('_Combined'[Customer name])&lt;BR /&gt;VAR currentDate = MAX('*DATE TABLE'[Date])&lt;/P&gt;&lt;P&gt;VAR allPreviousCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;ALL('_Combined'),&lt;BR /&gt;'*DATE TABLE'[Date] &amp;lt; DATE(YEAR(currentDate), 1, 1)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR newCustomers = EXCEPT(currentCustomers, allPreviousCustomers)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;COUNTROWS(newCustomers)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;New Customers Sales =&lt;BR /&gt;VAR currentCustomers = VALUES('_Combined'[Customer name])&lt;BR /&gt;VAR currentDate = MAX('*DATE TABLE'[Date])&lt;/P&gt;&lt;P&gt;VAR allPreviousCustomers = CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;ALL('_Combined'),&lt;BR /&gt;'*DATE TABLE'[Date] &amp;lt; YEAR(currentDate)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('_Combined'[Amount EUR]),&lt;BR /&gt;'_Combined'[Customer name] IN VALUES('_Combined'[Customer name])&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In these revised measures, I've replaced the calculation for allPreviousCustomers to include all customers who made purchases before the current year, not just the previous year. This should give you the count of new customers and their sales based on their entire purchase history up to the current date.&lt;/P&gt;&lt;P&gt;Please test these changes and let me know if they meet your requirements. If you have any further questions or concerns, feel free to ask!&lt;/P&gt;</description>
    <pubDate>Wed, 13 Dec 2023 06:30:55 GMT</pubDate>
    <dc:creator>123abc</dc:creator>
    <dc:date>2023-12-13T06:30:55Z</dc:date>
    <item>
      <title>New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3579739#M138056</link>
      <description>&lt;P&gt;Hi, could you help me with this measure?&lt;BR /&gt;I'm not sure about the below calculations I've created to return count of absolute new customers in a table. The measure should look at all available data but return only new customers for specific year.&lt;/P&gt;&lt;P&gt;(Moreover, the totals don't add up to neither of the measures)&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;New Customers Year =&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;currentCustomers&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'_Combined'&lt;/SPAN&gt;&lt;SPAN&gt;[Customer name]&lt;/SPAN&g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lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 12 Dec 2023 12:56:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3579739#M138056</guid>
      <dc:creator>mbacicci</dc:creator>
      <dc:date>2023-12-12T12:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3579928#M138067</link>
      <description>&lt;P&gt;Your measures for calculating new customers and new customer sales seem to be on the right track. However, there are a few improvements that can be made, especially in terms of performance and correctness.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;New Customers Year Measure:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The calculation of prevYear seems correct, but it's always a good practice to use a date function to get the previous year.&lt;/LI&gt;&lt;LI&gt;You can simplify the pastCustomers calculation using the DATESBETWEEN function to filter the customers who made a purchase in the previous year.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here's an updated version:&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;New Customers Year =&lt;BR /&gt;VAR currentCustomers = VALUES('_Combined'[Customer name])&lt;BR /&gt;VAR currentDate = MAX('*DATE TABLE'[Date])&lt;BR /&gt;VAR prevYearStart = DATEADD(currentDate, -1, YEAR)&lt;BR /&gt;VAR prevYearEnd = DATEADD(currentDate, -1, YEAR) - 1&lt;BR /&gt;VAR pastCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;ALL('_Combined'),&lt;BR /&gt;DATESBETWEEN('*DATE TABLE'[Date], prevYearStart, prevYearEnd)&lt;BR /&gt;)&lt;BR /&gt;VAR newCustomers = EXCEPT(currentCustomers, pastCustomers)&lt;BR /&gt;RETURN&lt;BR /&gt;COUNTROWS(newCustomers)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;New Customers Sales Measure:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The pastCustomers calculation can also be simplified using DATESBETWEEN.&lt;/LI&gt;&lt;LI&gt;You can use the SUMX function to directly calculate the sum of sales for new customers.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here's an updated version:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Customers Sales =&lt;BR /&gt;VAR currentCustomers = VALUES('_Combined'[Customer name])&lt;BR /&gt;VAR currentDate = MAX('*DATE TABLE'[Date])&lt;BR /&gt;VAR prevYearStart = DATEADD(currentDate, -1, YEAR)&lt;BR /&gt;VAR prevYearEnd = DATEADD(currentDate, -1, YEAR) - 1&lt;BR /&gt;VAR pastCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;ALL('_Combined'),&lt;BR /&gt;DATESBETWEEN('*DATE TABLE'[Date], DATE(YEAR(currentDate), 1, 1), prevYearEnd)&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;SUMX(&lt;BR /&gt;FILTER(&lt;BR /&gt;'_Combined',&lt;BR /&gt;'_Combined'[Customer name] IN currentCustomers &amp;amp;&amp;amp; '_Combined'[Customer name] IN newCustomers&lt;BR /&gt;),&lt;BR /&gt;'_Combined'[Amount EUR]&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;These changes should enhance the performance and correctness of your measures. Always remember to test your measures with different scenarios to ensure they provide the expected results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 14:23:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3579928#M138067</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-12-12T14:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3580033#M138074</link>
      <description>&lt;P&gt;Thank you! I will test them and let you know.&lt;BR /&gt;About your changes, do I see correctly that you're comparing only to previous year? The count of new customers (and their sales) should be year over year based on&amp;nbsp;&lt;U&gt;all&lt;/U&gt; previous years, not only the last one.&lt;BR /&gt;In short: we would consider ABC a new customer in 2022 only a customer that has never bought before, back until the database has invoicing data. Not only if ABC didn't purchase on 2021.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 15:08:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3580033#M138074</guid>
      <dc:creator>mbacicci</dc:creator>
      <dc:date>2023-12-12T15:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3581164#M138136</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I see, thank you for the clarification. If you want to identify customers who are new in the current year based on their entire purchase history, you should modify the measures accordingly. Here's the updated code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Customers Year =&lt;BR /&gt;VAR currentCustomers = VALUES('_Combined'[Customer name])&lt;BR /&gt;VAR currentDate = MAX('*DATE TABLE'[Date])&lt;/P&gt;&lt;P&gt;VAR allPreviousCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;ALL('_Combined'),&lt;BR /&gt;'*DATE TABLE'[Date] &amp;lt; DATE(YEAR(currentDate), 1, 1)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR newCustomers = EXCEPT(currentCustomers, allPreviousCustomers)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;COUNTROWS(newCustomers)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;New Customers Sales =&lt;BR /&gt;VAR currentCustomers = VALUES('_Combined'[Customer name])&lt;BR /&gt;VAR currentDate = MAX('*DATE TABLE'[Date])&lt;/P&gt;&lt;P&gt;VAR allPreviousCustomers = CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;ALL('_Combined'),&lt;BR /&gt;'*DATE TABLE'[Date] &amp;lt; YEAR(currentDate)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('_Combined'[Amount EUR]),&lt;BR /&gt;'_Combined'[Customer name] IN VALUES('_Combined'[Customer name])&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In these revised measures, I've replaced the calculation for allPreviousCustomers to include all customers who made purchases before the current year, not just the previous year. This should give you the count of new customers and their sales based on their entire purchase history up to the current date.&lt;/P&gt;&lt;P&gt;Please test these changes and let me know if they meet your requirements. If you have any further questions or concerns, feel free to ask!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 06:30:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3581164#M138136</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-12-13T06:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3582085#M138184</link>
      <description>&lt;P&gt;Clear, thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403667" data-lia-user-login="123abc" class="lia-mention lia-mention-user"&gt;123abc&lt;/a&gt;!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;What is the main difference between the measures I was using and the last ones you've sent?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;New Customers Year&lt;/STRONG&gt; works well and shows a slighly lower number compared to my original one.&amp;nbsp;&lt;STRONG&gt;New Customers Sales&lt;/STRONG&gt; shows total invoiced amounts per year instead.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I have another table connected which is called&lt;STRONG&gt; _Products&lt;/STRONG&gt;, and I would like to filter the new customers per year&amp;nbsp;&lt;U&gt;also&lt;/U&gt; based on the column&amp;nbsp;&lt;STRONG&gt;Product Origin&lt;/STRONG&gt; they've been invoiced for. Is there a way to include this in the both measures?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 14:17:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3582085#M138184</guid>
      <dc:creator>mbacicci</dc:creator>
      <dc:date>2023-12-13T14:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3583221#M138240</link>
      <description>&lt;P&gt;I'm glad to hear that the New Customers Year measure is working well. Regarding the difference between the measures, the main change I made is in how we identify past customers. Instead of looking only at the previous year, we now consider all customers who made a purchase before the current year.&lt;/P&gt;&lt;P&gt;Now, for incorporating the _Products table and filtering new customers based on the Product Origin column, we can modify the measures accordingly. Here are the updated measures:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Customers Year =&lt;BR /&gt;VAR currentCustomers = VALUES('_Combined'[Customer name])&lt;BR /&gt;VAR currentDate = MAX('*DATE TABLE'[Date])&lt;BR /&gt;VAR currentYear = YEAR(currentDate)&lt;/P&gt;&lt;P&gt;VAR allPastCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;ALL('_Combined'),&lt;BR /&gt;'*DATE TABLE'[Date] &amp;lt; DATE(currentYear, 1, 1)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR newCustomers = EXCEPT(currentCustomers, allPastCustomers)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;COUNTROWS(&lt;BR /&gt;FILTER(&lt;BR /&gt;newCustomers,&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS('_Products'),&lt;BR /&gt;ALL('_Products'),&lt;BR /&gt;'_Combined'[Customer name] = newCustomers[Customer name]&lt;BR /&gt;) &amp;gt; 0&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;New Customers Sales =&lt;BR /&gt;VAR currentCustomers = VALUES('_Combined'[Customer name])&lt;BR /&gt;VAR currentDate = MAX('*DATE TABLE'[Date])&lt;BR /&gt;VAR currentYear = YEAR(currentDate)&lt;/P&gt;&lt;P&gt;VAR allPastCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;ALL('_Combined'),&lt;BR /&gt;'*DATE TABLE'[Date] &amp;lt; DATE(currentYear, 1, 1)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR newCustomers = EXCEPT(currentCustomers, allPastCustomers)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('_Combined'[Amount EUR]),&lt;BR /&gt;FILTER(&lt;BR /&gt;'_Combined',&lt;BR /&gt;'_Combined'[Customer name] IN VALUES('_Combined'[Customer name]) &amp;amp;&amp;amp;&lt;BR /&gt;YEAR('_Combined'[Date]) = currentYear &amp;amp;&amp;amp;&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS('_Products'),&lt;BR /&gt;ALL('_Products'),&lt;BR /&gt;'_Combined'[Customer name] = VALUES('_Combined'[Customer name])&lt;BR /&gt;) &amp;gt; 0&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In these updated measures, I added a filter based on the _Products table in both measures. It checks if the customer has been invoiced for any product with a non-zero count in the Product Origin column. Adjust the column names as needed based on your actual data model.&lt;/P&gt;&lt;P&gt;Please test these measures and let me know if they now work as expected.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 05:33:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3583221#M138240</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-12-14T05:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3583296#M138247</link>
      <description>&lt;P&gt;It makes sense, thank you again&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403667" data-lia-user-login="123abc" class="lia-mention lia-mention-user"&gt;123abc&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;New Customers Year &lt;/STRONG&gt;now gives me the error&amp;nbsp;"cannot find table 'newcustomers'. I think referring to this.&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;EM&gt;'_Combined'[Customer name] = newCustomers[Customer name]&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;As a note, the table&lt;STRONG&gt; _Products &lt;/STRONG&gt;doesn't have &lt;EM&gt;Customer name&lt;/EM&gt;.&lt;STRONG&gt; I&lt;/STRONG&gt;t's just a list of all product information for products sold, and it has an active relationship with&lt;STRONG&gt;&amp;nbsp;_Combined &lt;/STRONG&gt;with a column called&amp;nbsp;&lt;EM&gt;Item No&lt;/EM&gt;.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;&lt;STRONG&gt;New Customers Sales&lt;/STRONG&gt;&amp;nbsp;is still showing total invoiced amounts for those years.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;Let me know if you need any more information about the&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 14 Dec 2023 06:49:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3583296#M138247</guid>
      <dc:creator>mbacicci</dc:creator>
      <dc:date>2023-12-14T06:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3593000#M138744</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403667" data-lia-user-login="123abc" class="lia-mention lia-mention-user"&gt;123abc&lt;/a&gt;&amp;nbsp;, sorry for bothering still&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;BR /&gt;I've tried different options but I'm still not able to build the right measure for what I mentioned here. May I ask you for your help once more?&lt;BR /&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 07:27:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3593000#M138744</guid>
      <dc:creator>mbacicci</dc:creator>
      <dc:date>2023-12-20T07:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3593588#M138811</link>
      <description>&lt;P&gt;Let's address these issues step by step.&lt;/P&gt;&lt;H3&gt;1. Error in New Customers Year Measure:&lt;/H3&gt;&lt;P&gt;The error is occurring because newCustomers is not a table with a Customer name column. Instead, it's a list of distinct customer names. You cannot directly compare a table with a column in DAX without using functions like IN.&lt;/P&gt;&lt;P&gt;Let's modify the New Customers Year with Product Origin measure to correct this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Customers Year with Product Origin =&lt;BR /&gt;VAR currentCustomers = VALUES('_Combined'[Customer name])&lt;BR /&gt;VAR currentYear = YEAR(MAX('*DATE TABLE'[Date]))&lt;BR /&gt;VAR selectedProductOrigin = "YourSelectedProductOriginValue" -- Replace with the product origin value you want to filter by&lt;/P&gt;&lt;P&gt;VAR newCustomers =&lt;BR /&gt;FILTER(&lt;BR /&gt;currentCustomers,&lt;BR /&gt;[First Purchase Year] = currentYear &amp;amp;&amp;amp;&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS('_Combined'),&lt;BR /&gt;FILTER(&lt;BR /&gt;'_Combined',&lt;BR /&gt;'_Combined'[Customer name] = currentCustomers &amp;amp;&amp;amp; -- Directly comparing with the list of current customers&lt;BR /&gt;'_Combined'[Product Origin] = selectedProductOrigin&lt;BR /&gt;)&lt;BR /&gt;) &amp;gt; 0 -- This ensures that the new customer has purchased the selected product origin at least once&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;COUNTROWS(newCustomers)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;New Customers Sales Issue:&lt;/H3&gt;&lt;P&gt;For the New Customers Sales with Product Origin measure, the aim is to get the sales amount for new customers of the specified product origin in the current year.&lt;/P&gt;&lt;P&gt;Let's correct this by explicitly filtering the sales for the new customers of the specified product origin:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Customers Sales with Product Origin =&lt;BR /&gt;VAR currentCustomers = VALUES('_Combined'[Customer name])&lt;BR /&gt;VAR currentYear = YEAR(MAX('*DATE TABLE'[Date]))&lt;BR /&gt;VAR selectedProductOrigin = "YourSelectedProductOriginValue" -- Replace with the product origin value you want to filter by&lt;/P&gt;&lt;P&gt;VAR newCustomers =&lt;BR /&gt;FILTER(&lt;BR /&gt;currentCustomers,&lt;BR /&gt;[First Purchase Year] = currentYear &amp;amp;&amp;amp;&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS('_Combined'),&lt;BR /&gt;FILTER(&lt;BR /&gt;'_Combined',&lt;BR /&gt;'_Combined'[Customer name] = currentCustomers &amp;amp;&amp;amp; -- Directly comparing with the list of current customers&lt;BR /&gt;'_Combined'[Product Origin] = selectedProductOrigin&lt;BR /&gt;)&lt;BR /&gt;) &amp;gt; 0 -- This ensures that the new customer has purchased the selected product origin at least once&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('_Combined'[Amount EUR]),&lt;BR /&gt;'_Combined'[Customer name] IN newCustomers&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;These adjustments should help you get the desired results. Make sure to replace &lt;/SPAN&gt;"YourSelectedProductOriginValue"&lt;SPAN&gt; with the actual product origin value you wish to filter by.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 10:54:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3593588#M138811</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-12-20T10:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3593590#M138812</link>
      <description>&lt;P&gt;Of course! Let's simplify and address this step-by-step.&lt;/P&gt;&lt;P&gt;Your main requirement is to calculate the count of new customers for a specific year and also to calculate the sales amount for those new customers based on a selected product origin.&lt;/P&gt;&lt;H3&gt;1. New Customers Year with Product Origin:&lt;/H3&gt;&lt;P&gt;First, let's identify the count of new customers for the specific year and product origin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Customers Year with Product Origin =&lt;BR /&gt;VAR currentYear = YEAR(MAX('*DATE TABLE'[Date]))&lt;BR /&gt;VAR selectedProductOrigin = "YourSelectedProductOriginValue" -- Replace with the product origin value you want to filter by&lt;/P&gt;&lt;P&gt;VAR newCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;'_Combined'[Product Origin] = selectedProductOrigin,&lt;BR /&gt;NOT EXISTS(&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;'_Combined',&lt;BR /&gt;'_Combined'[Product Origin] = selectedProductOrigin,&lt;BR /&gt;YEAR('_DATE TABLE'[Date]) &amp;lt; currentYear&lt;BR /&gt;),&lt;BR /&gt;'_Combined'[Customer name]&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;COUNTROWS(newCustomers)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;2. New Customers Sales with Product Origin:&lt;/H3&gt;&lt;P&gt;Next, let's calculate the sales amount for those new customers in the specified year and product origin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Customers Sales with Product Origin =&lt;BR /&gt;VAR currentYear = YEAR(MAX('*DATE TABLE'[Date]))&lt;BR /&gt;VAR selectedProductOrigin = "YourSelectedProductOriginValue" -- Replace with the product origin value you want to filter by&lt;/P&gt;&lt;P&gt;VAR newCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;'_Combined'[Product Origin] = selectedProductOrigin,&lt;BR /&gt;NOT EXISTS(&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;'_Combined',&lt;BR /&gt;'_Combined'[Product Origin] = selectedProductOrigin,&lt;BR /&gt;YEAR('_DATE TABLE'[Date]) &amp;lt; currentYear&lt;BR /&gt;),&lt;BR /&gt;'_Combined'[Customer name]&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('_Combined'[Amount EUR]),&lt;BR /&gt;'_Combined'[Customer name] IN newCustomers&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In both measures, I'm using the NOT EXISTS pattern to identify customers who have not made a purchase of the selected product origin before the current year. This should provide you with the count of new customers and their sales based on the selected product origin for the specified year.&lt;/P&gt;&lt;P&gt;Please replace "YourSelectedProductOriginValue" with the actual product origin value you want to filter by when using these measures.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 10:55:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3593590#M138812</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-12-20T10:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3594052#M138846</link>
      <description>&lt;P&gt;I get an error to&amp;nbsp;&lt;STRONG&gt;EXISTS&amp;nbsp;&lt;/STRONG&gt;saying it's not a function, so the overall measure has the banner "This is not a valid DAX expression".&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How could we change it?&lt;BR /&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403667" data-lia-user-login="123abc" class="lia-mention lia-mention-user"&gt;123abc&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 13:39:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3594052#M138846</guid>
      <dc:creator>mbacicci</dc:creator>
      <dc:date>2023-12-20T13:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3595411#M138909</link>
      <description>&lt;P&gt;Instead of using the EXISTS function, we can use the INTERSECT function to determine the intersection of two tables. This will allow us to identify new customers more efficiently.&lt;/P&gt;&lt;P&gt;Let's rewrite the measures using INTERSECT:&lt;/P&gt;&lt;H3&gt;1. Identify New Customers for Each Year:&lt;/H3&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Customers Year =&lt;BR /&gt;VAR currentYear = YEAR(MAX('*DATE TABLE'[Date]))&lt;/P&gt;&lt;P&gt;VAR allPastCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('_Combined'),&lt;BR /&gt;YEAR('_Combined'[Date]) &amp;lt; currentYear&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR newCustomers =&lt;BR /&gt;EXCEPT(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;allPastCustomers&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;COUNTROWS(newCustomers)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;2. Adjusting for Product Origin Filter:&lt;/H3&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Customers Year with Product Filter =&lt;BR /&gt;VAR currentYear = YEAR(MAX('*DATE TABLE'[Date]))&lt;/P&gt;&lt;P&gt;VAR allPastCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('_Combined'),&lt;BR /&gt;YEAR('_Combined'[Date]) &amp;lt; currentYear&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR potentialNewCustomers =&lt;BR /&gt;EXCEPT(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;allPastCustomers&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR newCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;potentialNewCustomers,&lt;BR /&gt;FILTER(&lt;BR /&gt;potentialNewCustomers,&lt;BR /&gt;'_Combined'[Item No] IN RELATEDTABLE('_Products')[Item No] &amp;amp;&amp;amp;&lt;BR /&gt;'_Combined'[Product Origin] IN VALUES('_Products'[Product Origin])&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;COUNTROWS(newCustomers)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;3. Sales from New Customers:&lt;/H3&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Customers Sales with Product Filter =&lt;BR /&gt;VAR currentYear = YEAR(MAX('*DATE TABLE'[Date]))&lt;/P&gt;&lt;P&gt;VAR allPastCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('_Combined'),&lt;BR /&gt;YEAR('_Combined'[Date]) &amp;lt; currentYear&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR potentialNewCustomers =&lt;BR /&gt;EXCEPT(&lt;BR /&gt;VALUES('_Combined'[Customer name]),&lt;BR /&gt;allPastCustomers&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR newCustomers =&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;potentialNewCustomers,&lt;BR /&gt;FILTER(&lt;BR /&gt;potentialNewCustomers,&lt;BR /&gt;'_Combined'[Item No] IN RELATEDTABLE('_Products')[Item No] &amp;amp;&amp;amp;&lt;BR /&gt;'_Combined'[Product Origin] IN VALUES('_Products'[Product Origin])&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('_Combined'[Amount EUR]),&lt;BR /&gt;FILTER(&lt;BR /&gt;'_Combined',&lt;BR /&gt;'_Combined'[Customer name] IN newCustomers&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;In these revised measures, I replaced the use of INTERSECT with EXCEPT to identify potential new customers and then further filtered them based on the Product Origin criteria from the _Products table.&lt;/P&gt;&lt;P&gt;Please try implementing these adjusted measures and let me know if they resolve the issue!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;In these revised measures, I replaced the use of INTERSECT with EXCEPT to identify potential new customers and then further filtered them based on the Product Origin criteria from the _Products table.&lt;/P&gt;&lt;P&gt;Please try implementing these adjusted measures and let me know if they resolve the issue!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 Dec 2023 05:21:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3595411#M138909</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-12-21T05:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: New Customer count and sales calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3595677#M138926</link>
      <description>&lt;H3&gt;2. Adjusting for Product Origin Filter:&amp;nbsp;I'm getting this error now for this.&lt;/H3&gt;&lt;P&gt;When I try and find Item No and Product Origin, the columns are not available while only measures in that table are. How can this be re-adapted?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The syntax for '[Item No]' is incorrect. (DAX(VAR currentYear = YEAR(MAX('*DATE TABLE'[Date]))VAR allPastCustomers =CALCULATETABLE(VALUES('_Combined'[Customer name]),FILTER(ALL('_Combined'),YEAR('_Combined'[Invoice date]) &amp;lt; currentYear))VAR potentialNewCustomers =EXCEPT(VALUES('_Combined'[Customer name]),allPastCustomers)VAR newCustomers =CALCULATETABLE(potentialNewCustomers,FILTER(potentialNewCustomers,'_Combined'[Item No] IN RELATEDTABLE('_Products')[Item No] &amp;amp;&amp;amp;'_Combined'[Product Origin] IN VALUES('_Products'[Product Origin])))RETURNCOUNTROWS(newCustomers))).&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 07:08:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/New-Customer-count-and-sales-calculation/m-p/3595677#M138926</guid>
      <dc:creator>mbacicci</dc:creator>
      <dc:date>2023-12-21T07:08:12Z</dc:date>
    </item>
  </channel>
</rss>

