<?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: Nested IF - dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-dates/m-p/2589809#M74572</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403139" data-lia-user-login="PC2022" class="lia-mention lia-mention-user"&gt;PC2022&lt;/a&gt; , Create a new column like&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=&lt;/P&gt;
&lt;P&gt;var _diff = datediff([finish date], today(), day)&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;Switch(True(),&lt;/P&gt;
&lt;P&gt;_diff &amp;gt;=45 , "Green",&lt;/P&gt;
&lt;P&gt;_diff &amp;gt; 0 , "Yellow",&lt;/P&gt;
&lt;P&gt;"Red"&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can use this column in conditional formatting using the field value option&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jun 2022 13:49:00 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2022-06-20T13:49:00Z</dc:date>
    <item>
      <title>Nested IF - dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-dates/m-p/2589785#M74571</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I need to create DAX for date KPI but i am practicing in excel first, so i could create formula in Power BI later.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Green - today is greater than 45 day period leading up to the finish date (please note that it should be 45 day time period, not just one date 45 days prior)&lt;/P&gt;&lt;P&gt;Yellow - today is within 45 days period leading up to the finish date (same note as above, it should be if today falls onto any date within 45 days time period).&lt;/P&gt;&lt;P&gt;Red - today is past finish date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My formula below doesn't seem to be right.&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, 20 Jun 2022 13:40:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-dates/m-p/2589785#M74571</guid>
      <dc:creator>PC2022</dc:creator>
      <dc:date>2022-06-20T13:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Nested IF - dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-dates/m-p/2589809#M74572</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403139" data-lia-user-login="PC2022" class="lia-mention lia-mention-user"&gt;PC2022&lt;/a&gt; , Create a new column like&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=&lt;/P&gt;
&lt;P&gt;var _diff = datediff([finish date], today(), day)&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;Switch(True(),&lt;/P&gt;
&lt;P&gt;_diff &amp;gt;=45 , "Green",&lt;/P&gt;
&lt;P&gt;_diff &amp;gt; 0 , "Yellow",&lt;/P&gt;
&lt;P&gt;"Red"&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can use this column in conditional formatting using the field value option&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 13:49:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-dates/m-p/2589809#M74572</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-06-20T13:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Nested IF - dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-dates/m-p/2589984#M74582</link>
      <description>&lt;P&gt;Thank you! Sorry, I am new to Power BI and a little confused on your answer:&lt;/P&gt;&lt;P&gt;Do you mean to create 2 columns?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1)&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;2)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 14:52:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-dates/m-p/2589984#M74582</guid>
      <dc:creator>PC2022</dc:creator>
      <dc:date>2022-06-20T14:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Nested IF - dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-dates/m-p/2606023#M75458</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403139" data-lia-user-login="PC2022" class="lia-mention lia-mention-user"&gt;PC2022&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;In fact, you can use one calculated column to achieve these, you only need to add a variable to store the first step result and use the switch function to check the diff and return color code.&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Color code =
VAR _diff =
    DATEDIFF ( [finish date], TODAY (), DAY )
RETURN
    SWITCH ( TRUE (), _diff &amp;gt;= 45, "Green", _diff &amp;gt; 0, "Yellow", "Red" )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;After these steps, you can right-click on your field that needs to be formatted with 'field value' mode based on the above 'color code' column field values.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting#color-by-color-values" target="_blank"&gt;Apply conditional table formatting in Power BI - Power BI | Microsoft Docs&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 08:01:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-dates/m-p/2606023#M75458</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-28T08:01:45Z</dc:date>
    </item>
  </channel>
</rss>

