<?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 DAX - IF Field Time Matches specific value in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/DAX-IF-Field-Time-Matches-specific-value/m-p/2753920#M38486</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am trying to do an if statement in DAX. I want to say if the date is = 2018, then use this other calculation, else do another separate calculation. The data starts in 2018 and the rules change for every year after that. So I need one set of logic to sum the 2018 and another for everything after. I am doing this for Tax purposes and we always need a beginning balance to calculate down to an ending balance. Which will become the beginning balance the following year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Though the initial validation step in the if statement where I say "if time period equals 2018" it does not like the syntax. I can use the same exact syntax in a Calculate SUM formula - and the Year (xxxxxxx) ="2018" works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am seeing is below. I call out the table and field, ask it to look at only the year, then validate.&amp;nbsp;It works in one context but not the other.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WV_0-1662584564860.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/779700i52A18D59A58EC220/image-size/large?v=v2&amp;amp;px=999" role="button" title="WV_0-1662584564860.png" alt="WV_0-1662584564860.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;E&amp;amp;P Ending Balance = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Year&lt;/SPAN&gt;&lt;SPAN&gt;('Master_TB_FC Detail'[Time Period]) = &lt;/SPAN&gt;&lt;SPAN&gt;2018&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// CALCULATE (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// &amp;nbsp; &amp;nbsp; SUM ( 'Master_TB_FC Detail'[TB Amounts] ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// &amp;nbsp; &amp;nbsp; FILTER ( 'Master_TB_FC Detail', Year('Master_TB_FC Detail'[Time Period]) = 2018&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// )))))))))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no idea why in the context of the If statement that is failing. The time period field is formatted as a date.&lt;BR /&gt;&lt;BR /&gt;Any help here is greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;WV&lt;/P&gt;</description>
    <pubDate>Wed, 07 Sep 2022 21:12:28 GMT</pubDate>
    <dc:creator>WV</dc:creator>
    <dc:date>2022-09-07T21:12:28Z</dc:date>
    <item>
      <title>DAX - IF Field Time Matches specific value</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/DAX-IF-Field-Time-Matches-specific-value/m-p/2753920#M38486</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am trying to do an if statement in DAX. I want to say if the date is = 2018, then use this other calculation, else do another separate calculation. The data starts in 2018 and the rules change for every year after that. So I need one set of logic to sum the 2018 and another for everything after. I am doing this for Tax purposes and we always need a beginning balance to calculate down to an ending balance. Which will become the beginning balance the following year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Though the initial validation step in the if statement where I say "if time period equals 2018" it does not like the syntax. I can use the same exact syntax in a Calculate SUM formula - and the Year (xxxxxxx) ="2018" works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am seeing is below. I call out the table and field, ask it to look at only the year, then validate.&amp;nbsp;It works in one context but not the other.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WV_0-1662584564860.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/779700i52A18D59A58EC220/image-size/large?v=v2&amp;amp;px=999" role="button" title="WV_0-1662584564860.png" alt="WV_0-1662584564860.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;E&amp;amp;P Ending Balance = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Year&lt;/SPAN&gt;&lt;SPAN&gt;('Master_TB_FC Detail'[Time Period]) = &lt;/SPAN&gt;&lt;SPAN&gt;2018&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// CALCULATE (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// &amp;nbsp; &amp;nbsp; SUM ( 'Master_TB_FC Detail'[TB Amounts] ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// &amp;nbsp; &amp;nbsp; FILTER ( 'Master_TB_FC Detail', Year('Master_TB_FC Detail'[Time Period]) = 2018&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// )))))))))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no idea why in the context of the If statement that is failing. The time period field is formatted as a date.&lt;BR /&gt;&lt;BR /&gt;Any help here is greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;WV&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 21:12:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/DAX-IF-Field-Time-Matches-specific-value/m-p/2753920#M38486</guid>
      <dc:creator>WV</dc:creator>
      <dc:date>2022-09-07T21:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - IF Field Time Matches specific value</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/DAX-IF-Field-Time-Matches-specific-value/m-p/2754487#M38496</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/438730"&gt;@WV&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need get one date value from the field first for year(). Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Year&lt;/SPAN&gt;&lt;SPAN&gt;(max(Master_TB_FC Detail'[Time Period])) =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;2018&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 07:01:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/DAX-IF-Field-Time-Matches-specific-value/m-p/2754487#M38496</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-09-08T07:01:44Z</dc:date>
    </item>
  </channel>
</rss>

