<?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 Translating the IF statement into DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Translating-the-IF-statement-into-DAX/m-p/876526#M7367</link>
    <description>I have an easy-sounding issue, in theory but am trying to translate this into DAX logic.&lt;BR /&gt;I'm trying to translate this logic using a nested IF statement where, it reads for every year and will take the latest version of a document. If there's only one submission, "Submission", then it will take this version. Otherwise, if there's an amended submission "Amended Submission", it will take the latest amended document submission for that year, i.e. "Amended Submission". Not all years have "Amended Submission", some years may just have a "Submission".&lt;BR /&gt;&lt;BR /&gt;E.g. IF (Table[YA]=2019, IF(Document="Amended Submission", "Y","N"), IF(Table[YA]=2018, IF (Document="Amended Submission","Y","N")))...&lt;BR /&gt;&lt;BR /&gt;Any help would be great!&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;Nur</description>
    <pubDate>Tue, 17 Dec 2019 00:50:06 GMT</pubDate>
    <dc:creator>nursyeha001</dc:creator>
    <dc:date>2019-12-17T00:50:06Z</dc:date>
    <item>
      <title>Translating the IF statement into DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Translating-the-IF-statement-into-DAX/m-p/876526#M7367</link>
      <description>I have an easy-sounding issue, in theory but am trying to translate this into DAX logic.&lt;BR /&gt;I'm trying to translate this logic using a nested IF statement where, it reads for every year and will take the latest version of a document. If there's only one submission, "Submission", then it will take this version. Otherwise, if there's an amended submission "Amended Submission", it will take the latest amended document submission for that year, i.e. "Amended Submission". Not all years have "Amended Submission", some years may just have a "Submission".&lt;BR /&gt;&lt;BR /&gt;E.g. IF (Table[YA]=2019, IF(Document="Amended Submission", "Y","N"), IF(Table[YA]=2018, IF (Document="Amended Submission","Y","N")))...&lt;BR /&gt;&lt;BR /&gt;Any help would be great!&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;Nur</description>
      <pubDate>Tue, 17 Dec 2019 00:50:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Translating-the-IF-statement-into-DAX/m-p/876526#M7367</guid>
      <dc:creator>nursyeha001</dc:creator>
      <dc:date>2019-12-17T00:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Translating the IF statement into DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Translating-the-IF-statement-into-DAX/m-p/876695#M7377</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="134965" data-lia-user-login="nursyeha001" class="lia-mention lia-mention-user"&gt;nursyeha001&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Your example does not seem to follow your written example. ATR? is not mentioned in the written portion. I also cannot tell if you have multiple tables and the relationships.&lt;BR /&gt;&lt;BR /&gt;If you would share your pbix, or dummy up some values in Excel both for current and expected data. Please copy and paste them into your post, rather than doing a picture, we may be able to help you.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Please read this post to get your question answered more quickly:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 19:31:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Translating-the-IF-statement-into-DAX/m-p/876695#M7377</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2019-12-16T19:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Translating the IF statement into DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Translating-the-IF-statement-into-DAX/m-p/883240#M7603</link>
      <description>&lt;P&gt;Hi Nathaniel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's all in one table that I'm importing into Power BI and need to transform using DAX to create a column, &lt;EM&gt;Valid Record&lt;/EM&gt;, that for each person, looks at the Assignments submitted for the Year and takes the latest version indicated with&amp;nbsp; Y, any earlier versions will be indicated as a N.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Data:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;First Name&lt;/TD&gt;&lt;TD&gt;Last Name&lt;/TD&gt;&lt;TD&gt;Year&lt;/TD&gt;&lt;TD&gt;Assignments&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;Valid Record&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Peter&lt;/TD&gt;&lt;TD&gt;Parker&lt;/TD&gt;&lt;TD&gt;2015&lt;/TD&gt;&lt;TD&gt;Submission&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;N&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Peter&lt;/TD&gt;&lt;TD&gt;Parker&lt;/TD&gt;&lt;TD&gt;2015&lt;/TD&gt;&lt;TD&gt;Amended Submission&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;Y&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Tony&lt;/TD&gt;&lt;TD&gt;Stark&lt;/TD&gt;&lt;TD&gt;2017&lt;/TD&gt;&lt;TD&gt;Submission&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;Y&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Bruce&lt;/TD&gt;&lt;TD&gt;Wayne&lt;/TD&gt;&lt;TD&gt;2018&lt;/TD&gt;&lt;TD&gt;Submission&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;N&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Bruce&lt;/TD&gt;&lt;TD&gt;Wayne&lt;/TD&gt;&lt;TD&gt;2018&lt;/TD&gt;&lt;TD&gt;Amended Submission&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;Y&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Nur&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2019 01:39:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Translating-the-IF-statement-into-DAX/m-p/883240#M7603</guid>
      <dc:creator>nursyeha001</dc:creator>
      <dc:date>2019-12-24T01:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Translating the IF statement into DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Translating-the-IF-statement-into-DAX/m-p/883661#M7610</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="134965" data-lia-user-login="nursyeha001" class="lia-mention lia-mention-user"&gt;nursyeha001&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try adding a column with the expression below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Valid Result = 
VAR RowFirstName = 'Table'[First Name]
VAR RowLastName = 'Table'[Last Name]
VAR RowYear = 'Table'[Year]
VAR NoOfSubmissions = 
CALCULATE ( 
    COUNTROWS ( 
        FILTER ( 
            ALL ( 'Table' ),
            'Table'[First Name] = RowFirstName
            &amp;amp;&amp;amp; 'Table'[Last Name] = RowLastName
            &amp;amp;&amp;amp; 'Table'[Year] = RowYear
        )
    )    
)
VAR Result = 
SWITCH ( 
    TRUE(),
    NoOfSubmissions &amp;gt; 1 &amp;amp;&amp;amp; 'Table'[Assignments] = "Amended Submission", "Y",
    NoOfSubmissions = 1, "Y",
    "N"
)
RETURN Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: this expression won't work if you have 2 or more people with the same name in the same year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Martyn&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2019 19:15:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Translating-the-IF-statement-into-DAX/m-p/883661#M7610</guid>
      <dc:creator>MartynRamsden</dc:creator>
      <dc:date>2019-12-24T19:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Translating the IF statement into DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Translating-the-IF-statement-into-DAX/m-p/883869#M7614</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="134965" data-lia-user-login="nursyeha001" class="lia-mention lia-mention-user"&gt;nursyeha001&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="98062" data-lia-user-login="MartynRamsden" class="lia-mention lia-mention-user"&gt;MartynRamsden&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;This also will not work if there are more than a max of two entries per year per person. For instance if you had two "Amended Submissions". So, as&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="98062" data-lia-user-login="MartynRamsden" class="lia-mention lia-mention-user"&gt;MartynRamsden&lt;/a&gt;&amp;nbsp; points out if two people have the same name this will not work, my suggestion is that you include in your table a unique identifier (an ID), and that you also have month, day, year to figure out which is the latest submission. Or as an alternative to a full date, you could have the submissions numbered, and we would take the maximum submission per unique ID.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2019 17:18:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Translating-the-IF-statement-into-DAX/m-p/883869#M7614</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2019-12-24T17:18:00Z</dc:date>
    </item>
  </channel>
</rss>

