<?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 First occurence with multiple conditions in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-occurence-with-multiple-conditions/m-p/3034828#M103864</link>
    <description>&lt;P&gt;Hi, I am new to DAX and would like to create a measure that produce a column called [Rookie year] to count the first occurence of an individual that purchased an item based on other variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;those are the other conditions to be considered in order to be counted as first occurence :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- His client number wich is unique to him and stay's the same year after year is called [N certificat]&lt;/P&gt;&lt;P&gt;- In the column [Statut certificat] It as to be "Permanent"&lt;/P&gt;&lt;P&gt;- The date of [Date certificat] as to be within 5 years of the date of purchase wich is the column [Date emission permis] in order to count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So each [N certificat] as to appear only once in the column rookie year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;see picture below for a more visual look of an example table. the datas are not the real datas so the occurence dont match.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ive fiddled with some of the formulas found in the forum but couldnt find one that I am able to translate to my needs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much !&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2023 20:32:24 GMT</pubDate>
    <dc:creator>BenMagn</dc:creator>
    <dc:date>2023-01-20T20:32:24Z</dc:date>
    <item>
      <title>First occurence with multiple conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-occurence-with-multiple-conditions/m-p/3034828#M103864</link>
      <description>&lt;P&gt;Hi, I am new to DAX and would like to create a measure that produce a column called [Rookie year] to count the first occurence of an individual that purchased an item based on other variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;those are the other conditions to be considered in order to be counted as first occurence :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- His client number wich is unique to him and stay's the same year after year is called [N certificat]&lt;/P&gt;&lt;P&gt;- In the column [Statut certificat] It as to be "Permanent"&lt;/P&gt;&lt;P&gt;- The date of [Date certificat] as to be within 5 years of the date of purchase wich is the column [Date emission permis] in order to count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So each [N certificat] as to appear only once in the column rookie year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;see picture below for a more visual look of an example table. the datas are not the real datas so the occurence dont match.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ive fiddled with some of the formulas found in the forum but couldnt find one that I am able to translate to my needs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much !&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 20:32:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-occurence-with-multiple-conditions/m-p/3034828#M103864</guid>
      <dc:creator>BenMagn</dc:creator>
      <dc:date>2023-01-20T20:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: First occurence with multiple conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-occurence-with-multiple-conditions/m-p/3034969#M103877</link>
      <description>&lt;P&gt;hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="502304" data-lia-user-login="BenMagn" class="lia-mention lia-mention-user"&gt;BenMagn&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unable to understand your expectation, could you provide also the expected result?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 23:01:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-occurence-with-multiple-conditions/m-p/3034969#M103877</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-01-20T23:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: First occurence with multiple conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-occurence-with-multiple-conditions/m-p/3037888#M104074</link>
      <description>&lt;P&gt;Hope this is easier to understand ! thanks!&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&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;</description>
      <pubDate>Mon, 23 Jan 2023 14:09:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-occurence-with-multiple-conditions/m-p/3037888#M104074</guid>
      <dc:creator>BenMagn</dc:creator>
      <dc:date>2023-01-23T14:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: First occurence with multiple conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-occurence-with-multiple-conditions/m-p/3039552#M104194</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="502304" data-lia-user-login="BenMagn" class="lia-mention lia-mention-user"&gt;BenMagn&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created a sample pbix file(see&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;the attachment&lt;/STRONG&gt;&lt;/EM&gt;), please check if that is what you want. You can create a &lt;STRONG&gt;measure&lt;/STRONG&gt; as below to get it:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rookie year = 
VAR _selncer =
    SELECTEDVALUE ( 'Table'[N certificat] )
VAR _mindep =
    CALCULATE (
        MIN ( 'Table'[Date emission permis] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[N certificat] = _selncer )
    )
VAR _tab =
    CALCULATETABLE (
        VALUES ( 'Table'[N certificat] ),
        FILTER (
            'Table',
            'Table'[N certificat] = _selncer
                &amp;amp;&amp;amp; 'Table'[Date emission permis] = _mindep
                &amp;amp;&amp;amp; 'Table'[Statut certificat] = "Permanent"
                &amp;amp;&amp;amp; 'Table'[Date emission permis] - 'Table'[Date certificat] &amp;lt;= 5
        )
    )
RETURN
    IF ( _selncer IN _tab, 1, 0 )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If the above one can't help you, could you please provide more&amp;nbsp;&lt;STRONG&gt;raw data&lt;/STRONG&gt;&amp;nbsp;in your tables (&lt;STRONG&gt;&lt;EM&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/EM&gt;&lt;/STRONG&gt;) with&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;format and your&amp;nbsp;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&amp;nbsp;with backend logic and special examples?&amp;nbsp;It would be helpful to find out the solution. You can refer the following links to share the required info:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-provide-sample-data-in-the-Power-BI-Forum%2Fba-p%2F963216&amp;amp;data=05%7C01%7CClaire.Dong%40microsoft.com%7Cada9149bd91546a8432508dacd31ef9b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638047911607737134%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=EJlYfclgtrjgAEYj9Uo1AauqxaQm3hlQsjJMo4zCY1M%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C01%7CClaire.Dong%40microsoft.com%7Cada9149bd91546a8432508dacd31ef9b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638047911607737134%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=7UEf71Mu2ySWC7MlgciaPViM1RqU5nx4OHGHG5EvNSw%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;And&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;pbix file. You can refer the following link to upload the file to the community. Thank you.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FDesktop%2FHow-to-upload-PBI-in-Community%2Fm-p%2F1672886&amp;amp;data=04%7C01%7Cv-yiruan%40microsoft.com%7C4f580813734d4a8355b008da16f6e91a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637847547341062885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;amp;sdata=YJvujige2YITXKbKED9JieQm5LBdf%2F3IYPM4ggdiijQ%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to upload PBI in Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 07:53:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-occurence-with-multiple-conditions/m-p/3039552#M104194</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-24T07:53:10Z</dc:date>
    </item>
  </channel>
</rss>

