<?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: Absenteeism - Calculating Total Working Days Lost when End Date of Absence Not Known in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2661346#M78914</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you can try to create a new measure based on this measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure with total = SUMX(VALUES('Table'[Role]),[Measure])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jul 2022 08:53:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-07-26T08:53:04Z</dc:date>
    <item>
      <title>Absenteeism - Calculating Total Working Days Lost when End Date of Absence Not Known</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2653704#M78314</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a monthly absence report and just now are restricted to only calculating the total working days lost for absences which are closed (i.e., have an end date). I would like to also be able to calculate the total working days lost till date for those absences which are still ongoing (no end date) in that month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My logic so far for the measure, is to count 1 working day lost for each date within the Absence Start Date and Absence End Date Range or count 1 working day lost for each date from the Absence Start Date until today if the end date is empty and then iterate through this count to sum the total working days lost but I am struggling to come up with the correct measure for this if anyone can help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a simple sample data structure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Role&lt;/TD&gt;&lt;TD&gt;Start Date of Absence&lt;/TD&gt;&lt;TD&gt;End Date of Absence&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Accountant&lt;/TD&gt;&lt;TD&gt;15/07/22&lt;/TD&gt;&lt;TD&gt;19/07/22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;HR Manager&lt;/TD&gt;&lt;TD&gt;14/07/22&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Data Analyst&lt;/TD&gt;&lt;TD&gt;01/07/22&lt;/TD&gt;&lt;TD&gt;11/07/22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Service Desk Analyst&lt;/TD&gt;&lt;TD&gt;20/07/22&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&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;</description>
      <pubDate>Thu, 21 Jul 2022 15:35:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2653704#M78314</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-21T15:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Absenteeism - Calculating Total Working Days Lost when End Date of Absence Not Known</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2653799#M78317</link>
      <description>&lt;P&gt;You could try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Work days lost =
VAR minDate =
    MIN ( 'Date'[Date] )
VAR maxDate =
    MAX ( 'Date'[Date] )
RETURN
    SUMX (
        'Absences',
        VAR startDate =
            MAX ( 'Absences'[Start date], minDate )
        VAR endDate =
            MIN ( 'Absences'[End date], maxDate )
        RETURN
            NETWORKDAYS ( startDate, endDate )
    )&lt;/LI-CODE&gt;&lt;P&gt;That should work with date filters to show days lost in a given month.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 16:08:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2653799#M78317</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-07-21T16:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Absenteeism - Calculating Total Working Days Lost when End Date of Absence Not Known</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2654030#M78333</link>
      <description>&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for this. It appears to work for the absences which have an end date but gives odd values for those which don't:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 18:20:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2654030#M78333</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-21T18:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: Absenteeism - Calculating Total Working Days Lost when End Date of Absence Not Known</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2661153#M78902</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you to try this code to create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _CALENDAR =ADDCOLUMNS( CALENDARAUTO(),"Weekday",WEEKDAY([Date],2))
VAR _FILTER = FILTER(_CALENDAR,[Date]&amp;gt;= MAX('Table'[Start Date of Absence])&amp;amp;&amp;amp;[Date]&amp;lt;=IF( MAX('Table'[End Date of Absence])=BLANK(),TODAY(),MAX('Table'[End Date of Absence])))
RETURN
COUNTX(FILTER(_FILTER,NOT( [Weekday] IN {6,7})),[Date])&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 08:05:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2661153#M78902</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-26T08:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: Absenteeism - Calculating Total Working Days Lost when End Date of Absence Not Known</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2661219#M78905</link>
      <description>&lt;P&gt;That is really great! It works perfectly in table form. I have used a slight variation of this measure for annual absences too and it works great. Having said that, do you know of a small edit I could make which would allow me to view the total working days lost over the date time-series.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 08:21:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2661219#M78905</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-26T08:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Absenteeism - Calculating Total Working Days Lost when End Date of Absence Not Known</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2661346#M78914</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you can try to create a new measure based on this measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure with total = SUMX(VALUES('Table'[Role]),[Measure])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 08:53:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Absenteeism-Calculating-Total-Working-Days-Lost-when-End-Date-of/m-p/2661346#M78914</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-26T08:53:04Z</dc:date>
    </item>
  </channel>
</rss>

