<?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: Calculation if there are new countries in the last 12 months in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-if-there-are-new-countries-in-the-last-12-months/m-p/2754068#M85065</link>
    <description>&lt;P&gt;Hi @&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F437631&amp;amp;data=05%7C01%7Cv-tangjie%40microsoft.com%7C66a31eebc9a6443c77be08da90b5c4d8%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637981407659207744%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=Aw8IIZK%2BNBRpoLP88w80tDrIf96CKzjlgKS5%2BZIBCnA%3D&amp;amp;reserved=0" target="_blank" rel="noopener"&gt;Arwen16&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;According to your description, You want to count countries that exist this month but did not exist last year,right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are my steps you can follow:&lt;/P&gt;&lt;P&gt;(1)This is my test data.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;(2)We can create a measure: &lt;SPAN&gt;“Measure&lt;/SPAN&gt;&lt;SPAN&gt;”.&lt;/SPAN&gt;&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;Measure = var max_date=  MAXX(ALL('Table'),'Table'[date])

var _current_month = FILTER('Table','Table'[date] &amp;lt;= max_date &amp;amp;&amp;amp; 'Table'[date] &amp;gt;= max_date -30)

var _pre_year = FILTER('Table', YEAR('Table'[date]) = YEAR(max_date)-1 )

return

IF( COUNTROWS(_current_month)&amp;gt;0 &amp;amp;&amp;amp; COUNTROWS(_pre_year) =BLANK() ,"NO" , BLANK())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(3)Then the result is as follows.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this method does not meet your needs, you can provide us with detailed input and output examples in tabular form so that we can better solve the problem for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Neeko Tang&lt;/P&gt;&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Sep 2022 05:58:36 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-09-08T05:58:36Z</dc:date>
    <item>
      <title>Calculation if there are new countries in the last 12 months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-if-there-are-new-countries-in-the-last-12-months/m-p/2749298#M84782</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;We have a table where it is stored by month the countries and the numbers of users registered in that month.&lt;/P&gt;&lt;P&gt;I would like to be able to get in a measure, if there are new countries in the latest month, that weren't in the database 12 months ago.&lt;/P&gt;&lt;P&gt;On the Power BI dashboard I want to add a card with the text: "there are no new countries in the last 12 months" if there are no new countries and nothing otherwise.&lt;/P&gt;&lt;P&gt;I was doing this counting the number or countries but the problem is that our users can deregister, which makes that maybe there are countries existing 12 months ago, that do not exist anymore in the latest month.&lt;/P&gt;&lt;P&gt;That is why I think I need to make a comparison of the exact countries 12 months ago and now and be able to count countries that exist this month but didn't exist 12 months ago.&lt;/P&gt;&lt;P&gt;Here some data to be able to be able to understand our table:&lt;/P&gt;&lt;P&gt;In this case I would like a measure that returns a 1 indicating that there are new countries in comparison to the last 12 months (NO is in 2022 but not in 2021). We can also see that there are 4 countries for both months but CH is not anymore listed in 2022.&lt;/P&gt;&lt;P&gt;I would really appreciate tips, how to address this issue with DAX.&lt;BR /&gt;Thanks!&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;date&lt;/TD&gt;&lt;TD&gt;country_iso2&lt;/TD&gt;&lt;TD&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2022-08-01&lt;/TD&gt;&lt;TD&gt;UK&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2022-08-01&lt;/TD&gt;&lt;TD&gt;AT&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2022-08-01&lt;/TD&gt;&lt;TD&gt;NO&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2022-08-01&lt;/TD&gt;&lt;TD&gt;LI&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021-08-01&lt;/TD&gt;&lt;TD&gt;UK&lt;/TD&gt;&lt;TD&gt;800&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021-08-01&lt;/TD&gt;&lt;TD&gt;CH&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021-08-01&lt;/TD&gt;&lt;TD&gt;AT&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021-08-01&lt;/TD&gt;&lt;TD&gt;UK&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 09 Sep 2022 08:33:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-if-there-are-new-countries-in-the-last-12-months/m-p/2749298#M84782</guid>
      <dc:creator>Arwen16</dc:creator>
      <dc:date>2022-09-09T08:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation if there are new countries in the last 12 months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-if-there-are-new-countries-in-the-last-12-months/m-p/2750464#M84851</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="437631" data-lia-user-login="Arwen16" class="lia-mention lia-mention-user"&gt;Arwen16&lt;/a&gt; , refer if this customer retention logic can help &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Customer Retention Part 1:&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/ba-p/1361529" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/ba-p/1361529&lt;/A&gt;&lt;BR /&gt;Customer Retention Part 2: Period over Period Retention :&lt;A href="https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retention/ba-p/1377458" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retention/ba-p/1377458&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Power BI Items/Categories not sold to the customers&lt;BR /&gt;Power BI Items/Categories not sold to the customers: &lt;A href="https://youtu.be/AbuKvAnicwo" target="_blank"&gt;https://youtu.be/AbuKvAnicwo&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check for the new logic&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to measure like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rolling 12 = CALCULATE(Count(Table[Value]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if(not(isblank([Rolling 12])), "New", Blank())&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 13:41:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-if-there-are-new-countries-in-the-last-12-months/m-p/2750464#M84851</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-09-06T13:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation if there are new countries in the last 12 months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-if-there-are-new-countries-in-the-last-12-months/m-p/2754068#M85065</link>
      <description>&lt;P&gt;Hi @&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F437631&amp;amp;data=05%7C01%7Cv-tangjie%40microsoft.com%7C66a31eebc9a6443c77be08da90b5c4d8%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637981407659207744%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=Aw8IIZK%2BNBRpoLP88w80tDrIf96CKzjlgKS5%2BZIBCnA%3D&amp;amp;reserved=0" target="_blank" rel="noopener"&gt;Arwen16&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;According to your description, You want to count countries that exist this month but did not exist last year,right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are my steps you can follow:&lt;/P&gt;&lt;P&gt;(1)This is my test data.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;(2)We can create a measure: &lt;SPAN&gt;“Measure&lt;/SPAN&gt;&lt;SPAN&gt;”.&lt;/SPAN&gt;&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;Measure = var max_date=  MAXX(ALL('Table'),'Table'[date])

var _current_month = FILTER('Table','Table'[date] &amp;lt;= max_date &amp;amp;&amp;amp; 'Table'[date] &amp;gt;= max_date -30)

var _pre_year = FILTER('Table', YEAR('Table'[date]) = YEAR(max_date)-1 )

return

IF( COUNTROWS(_current_month)&amp;gt;0 &amp;amp;&amp;amp; COUNTROWS(_pre_year) =BLANK() ,"NO" , BLANK())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(3)Then the result is as follows.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this method does not meet your needs, you can provide us with detailed input and output examples in tabular form so that we can better solve the problem for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Neeko Tang&lt;/P&gt;&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 05:58:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-if-there-are-new-countries-in-the-last-12-months/m-p/2754068#M85065</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-08T05:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation if there are new countries in the last 12 months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-if-there-are-new-countries-in-the-last-12-months/m-p/2757608#M85324</link>
      <description>&lt;P&gt;Hi Anonymous&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;thank you for your answer. I understand your measures. What I forgot to mention is that my expected result is to show in a card a text just stating: "There are no new countries in the last 12 months" if there are not new countries in the last 12 months and nothing otherwise.&lt;BR /&gt;Your solution only works if I have a visualization that includes the country column in it.&lt;BR /&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 08:26:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-if-there-are-new-countries-in-the-last-12-months/m-p/2757608#M85324</guid>
      <dc:creator>Arwen16</dc:creator>
      <dc:date>2022-09-09T08:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation if there are new countries in the last 12 months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-if-there-are-new-countries-in-the-last-12-months/m-p/2757615#M85326</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for your answer!&lt;BR /&gt;I will check the links and see if I can adapt them to my needs.&lt;/P&gt;&lt;P&gt;What I forgot to mention is that my expected result is to show in a card a text just stating: "There are no new countries in the last 12 months" if there are not new countries in the last 12 months and nothing otherwise.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 08:32:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-if-there-are-new-countries-in-the-last-12-months/m-p/2757615#M85326</guid>
      <dc:creator>Arwen16</dc:creator>
      <dc:date>2022-09-09T08:32:33Z</dc:date>
    </item>
  </channel>
</rss>

