<?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 return text based off calender date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/return-text-based-off-calender-date/m-p/3497324#M134000</link>
    <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to Power Bi and need some help.&amp;nbsp; I have a data pull from excel that shows a due date for each line item.&amp;nbsp; Based off that due date and looking at a calendar, I am able to identify the status of that item.&amp;nbsp; For example:&amp;nbsp; Assume today's date is 10-25-23.&amp;nbsp; Anything prior to today is considered Past Due.&amp;nbsp; Anything with a due date of today is considered Due Today.&amp;nbsp; Anything due in the next two days (making sure to account for weekends and holidays) is Due in Two Days.&amp;nbsp; Anything further out than that is On track.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal is to eventually have the data auto pull from the website and update the dashboard automatically.&amp;nbsp; Is there a way to create a column in Power BI to auto update the status based off the due date and keeping weekends / holidays in mind?&amp;nbsp; I came up with a nested formual in excel, but think I am making this much harder than it needs to be.&amp;nbsp; Also, my calculation would have to be updated constantly to account for weekends / holidays.&amp;nbsp; At that point it was easier to just manually make the updates as I was concened about it returning the correct response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please help?&lt;/P&gt;</description>
    <pubDate>Wed, 25 Oct 2023 20:07:20 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-10-25T20:07:20Z</dc:date>
    <item>
      <title>return text based off calender date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/return-text-based-off-calender-date/m-p/3497324#M134000</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to Power Bi and need some help.&amp;nbsp; I have a data pull from excel that shows a due date for each line item.&amp;nbsp; Based off that due date and looking at a calendar, I am able to identify the status of that item.&amp;nbsp; For example:&amp;nbsp; Assume today's date is 10-25-23.&amp;nbsp; Anything prior to today is considered Past Due.&amp;nbsp; Anything with a due date of today is considered Due Today.&amp;nbsp; Anything due in the next two days (making sure to account for weekends and holidays) is Due in Two Days.&amp;nbsp; Anything further out than that is On track.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal is to eventually have the data auto pull from the website and update the dashboard automatically.&amp;nbsp; Is there a way to create a column in Power BI to auto update the status based off the due date and keeping weekends / holidays in mind?&amp;nbsp; I came up with a nested formual in excel, but think I am making this much harder than it needs to be.&amp;nbsp; Also, my calculation would have to be updated constantly to account for weekends / holidays.&amp;nbsp; At that point it was easier to just manually make the updates as I was concened about it returning the correct response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please help?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 20:07:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/return-text-based-off-calender-date/m-p/3497324#M134000</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-25T20:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: return text based off calender date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/return-text-based-off-calender-date/m-p/3497354#M134002</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;, this is a fairly standard problem. The way to solve it would be to create a Date dimension in your Power BI report. The Date dimension can have a column (e.g. IsWorkingDay) that indicates is a day is a working day or not. How you populate that column will depend on the needs of your solution. Having a Date dimension in place will make it easier to do many other time-based calculations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once you have created a Date dimension, you can then add a Calculated Column to your source data to work out what the DueStatus for each row is. The logic in this calculation will use today's date, the DueDate, and the Date dimension's IsWorkingDay flag to produce the Past Due, Due Today, Due in Two Days, On Track, or whichever other statuses are needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A basic demonstration of the Calculated Column, without using a Date dimension, is shown below.&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;DueStatus = 
    VAR daysdiff = DATEDIFF(TODAY(), YourTable[DueDate], DAY)
    RETURN
    SWITCH(TRUE(),
        daysdiff &amp;lt; 0, "Past Due",
        daysdiff = 0, "Due Today",
        daysdiff &amp;lt;= 2, "Due in Two Days",
        "On Track"
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using&amp;nbsp; this test data for YourTable:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;DueDate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;23 Oct 2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;24 Oct 2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;25 Oct 2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;26 Oct 2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;27 Oct 2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;28 Oct 2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29 Oct 2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30 Oct 2023&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is the output:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this the sort of thing you are looking for?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 20:50:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/return-text-based-off-calender-date/m-p/3497354#M134002</guid>
      <dc:creator>EylesIT</dc:creator>
      <dc:date>2023-10-25T20:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: return text based off calender date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/return-text-based-off-calender-date/m-p/3497404#M134006</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;, further to my first reply, I have created a solution which takes working days into account.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create a Date dimension table which has a WorkingDays column as an integer. For working days set this to 1, for non-working days set it to 0. In my example I used this data for October:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date&amp;nbsp;&amp;nbsp; WorkingDays&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;01-Oct-23&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;02-Oct-23&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03-Oct-23&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;04-Oct-23&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&g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p;nbsp;&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;WorkingDaysTillDueDate = 
    VAR duedate = YourTable[DueDate]
    VAR today = TODAY()
    RETURN
        SWITCH(TRUE(),
            duedate = today, 0,
            duedate &amp;lt; today,
            CALCULATE(
                0 - SUM(dimDate[WorkingDays]),
                dimDate[Date] &amp;gt;= duedate,
                dimDate[Date] &amp;lt; today
            ),
            duedate &amp;gt; today,
            CALCULATE(
                SUM(dimDate[WorkingDays]),
                dimDate[Date] &amp;gt; today,
                dimDate[Date] &amp;lt;= duedate
            )
        )&lt;/LI-CODE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now create another Calculated Column called DueStatus with this DAX expression:&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DueStatus = 
    VAR days = YourTable[WorkingDaysTillDueDate]
    RETURN
        SWITCH(TRUE(),
            days &amp;lt; 0, "Past Due",
            days = 0, "Due Today",
            days &amp;lt;= 2, "Due in Two Days",
            "On Track"
        )&lt;/LI-CODE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this today (25 Oct 2023) it gives me the following results for dates from 23 Oct to 30 Oct. And whenever you refresh the report, it will recalculate both Calculated Columns based on the current today's date.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will need to maintain the dimDate table by populating it with any future dates and what the WorkingDays field should be for each.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 21:45:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/return-text-based-off-calender-date/m-p/3497404#M134006</guid>
      <dc:creator>EylesIT</dc:creator>
      <dc:date>2023-10-25T21:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: return text based off calender date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/return-text-based-off-calender-date/m-p/3507996#M134583</link>
      <description>&lt;P&gt;Thank you very much for your help!!&amp;nbsp; I have been able to create the calculation in excel to produce the correct Date Status.&amp;nbsp; I have a report in Power Bi that I have recently created that is linked to a SP site and updates automatically.&amp;nbsp; My next goal is to figure out how to add this new calculation / rows to the current report so that I can have the details linked.&amp;nbsp; I am viewing videos online to learn how to do this (very new to Power BI).&amp;nbsp; Fingers crossed I can update this soon.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; Again, your help is very much appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 18:46:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/return-text-based-off-calender-date/m-p/3507996#M134583</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-31T18:46:35Z</dc:date>
    </item>
  </channel>
</rss>

