<?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: Aged tickets calculation using measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1338673#M23851</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , refer if this blog can help&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Refer this file&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropbox.com/s/excoqikgpyz5zvk/Current_employee.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/excoqikgpyz5zvk/Current_employee.pbix?dl=0&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Sep 2020 13:02:30 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2020-09-01T13:02:30Z</dc:date>
    <item>
      <title>Aged tickets calculation using measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1338285#M23830</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to calculate the date duration to find out the number of aged tickets per selected month.&lt;/P&gt;&lt;P&gt;The idea is the date duration changes dynamically based on the user select.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a measure to calculate the duration when a ticket is not closed (closed date is empty) and it's working okay.&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;Aged Tickets Not closed = 
var _max = MAXX(DateKey, DateKey[Date])
var not_closed = CALCULATE(
    DATEDIFF(
        MINX('All Tickets', 'All Tickets'[Created Date]),
        _max, DAY),
    FILTER(
        ALL(DateKey), 
        MONTH(DateKey[Date])
    )
)

return not_closed&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;Result -&amp;gt;&lt;/P&gt;&lt;P&gt;Created Date - Jul 30, 2020 = 171 Days, 161, 143...&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is when a ticket has a closed date, it should return all tickets closed in the selected month, but it only shows tickets created in the selected month.&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;var _max_c = MAXX('All Tickets', 'All Tickets'[Closed Date])
var closed = CALCULATE(
    DATEDIFF(
        MINX('All Tickets', 'All Tickets'[Created Date]),
        _max_c, DAY),
    FILTER(
        ALL(DateKey), 
        MONTH(DateKey[Date])
    ),
    USERELATIONSHIP('All Tickets'[Closed Date], DateKey[Date])
)
return closed&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result -&amp;gt;&lt;/P&gt;&lt;P&gt;I want to get all &lt;STRONG&gt;closed ticket&lt;/STRONG&gt; with "Aged Tickets Not closed" value in the selected month, not created.&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;Eventually what I want to achieve is to get aged tickets per selected month (Over "30 days", "60 days", "90 days' and so on) so the date calculation should be flexible.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried with column as well, it works fine with the closed date but it gives 0 when the ticket is in 'pending' status (closed date&amp;nbsp;blank).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been struggling with this for a couple of days, tried with columns, changing filters but no luck so far.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or tips would be appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 20:45:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1338285#M23830</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-01T20:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: Aged tickets calculation using measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1338609#M23840</link>
      <description>This part is just returning the full date table FILTER ( ALL ( DateKey ), MONTH ( DateKey[Date] ) )&lt;BR /&gt;&lt;BR /&gt;What are you trying to do with this? Also can you share the PBIX file?</description>
      <pubDate>Tue, 01 Sep 2020 12:38:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1338609#M23840</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2020-09-01T12:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Aged tickets calculation using measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1338673#M23851</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , refer if this blog can help&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Refer this file&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropbox.com/s/excoqikgpyz5zvk/Current_employee.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/excoqikgpyz5zvk/Current_employee.pbix?dl=0&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 13:02:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1338673#M23851</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-09-01T13:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Aged tickets calculation using measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1350415#M24338</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236628" data-lia-user-login="AntrikshSharma" class="lia-mention lia-mention-user"&gt;AntrikshSharma&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;for the response and sorry for the late reply!&lt;/P&gt;&lt;P&gt;Unfortunately, I cannot share the data as it is confidential.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm trying to do is,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to calculate the duration based on the selected month.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, list&lt;FONT color="#FF0000"&gt; &lt;STRONG&gt;all&amp;nbsp;&lt;SPAN&gt;closed tickets in July&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt; with date difference between created and closed.&lt;/P&gt;&lt;P&gt;Now it only lists &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;&lt;SPAN&gt;created tickets in July &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN&gt;when I select July.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope this made it clear what I want to achieve here &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 02:38:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1350415#M24338</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-07T02:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Aged tickets calculation using measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1350432#M24339</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt; , hope you have checked this -&lt;A href="https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Open is July- Based on Open date join to date table. We need use everything related to time from date table (Date, Month, qtr year etc)&lt;/P&gt;
&lt;P&gt;Closed in July - Open any time but have a closed date. In this we need a closed date join with Date table.&amp;nbsp; Use Userelation and use this inactive join on close date. Follow HR like or video -&lt;A href="https://youtu.be/e6Y-l_JtCq4" target="_blank"&gt;https://youtu.be/e6Y-l_JtCq4&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Open in July , closed&amp;nbsp; - Here, you need to work with the open date and close date is not blank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Need different slicer for open and close. In this case, you can use from dates in the table or need to have two date table. refer How I created two tables and created a cohort -&lt;A href="https://youtu.be/Q1vPWmfI25o" target="_blank"&gt;https://youtu.be/Q1vPWmfI25o&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 02:45:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1350432#M24339</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-09-07T02:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Aged tickets calculation using measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1350507#M24342</link>
      <description>&lt;P&gt;Thank you for the quick response&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have read and looked through your blog, .pbix, and youtube videos but couldn't figure out what the problem was, however, I managed to solve the issue by not using variables which is odd.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the solution I got it working.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Aged Tickets Not closed = 
var closed = CALCULATE(
    DATEDIFF(
        MINX('All Tickets', 'All Tickets'[Created Date]),
        MAX('All Tickets'[Closed Date]), DAY),
    FILTER(
        ALL('All Tickets'[Closed Date]), 
        MONTH('All Tickets'[Closed Date])
    ),
    USERELATIONSHIP(DateKey[Date], 'All Tickets'[Closed Date])
)

return closed&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;This is the result I wanted to get. -&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before this solution, I was using the variables like below, and it showed Opened and Closed tickets only in a selected month. (so the date difference never went over 30 days)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var _max_c = MAX('All Tickets'[Closed Date])
var _min = MINX('All Tickets', 'All Tickets'[Created Date])

var closed = CALCULATE(
    DATEDIFF(
       _min,
       _max_c, DAY),
    FILTER(
        ALL('All Tickets'[Closed Date]), 
        MONTH('All Tickets'[Closed Date])
    ),
    USERELATIONSHIP(DateKey[Date], 'All Tickets'[Closed Date])
)

return closed&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't understand what was playing up in behind the scene, but it is working okay now since I changed the DAX.&lt;/P&gt;&lt;P&gt;But thank you for your help, I really appreciate it!!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 03:31:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aged-tickets-calculation-using-measure/m-p/1350507#M24342</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-07T03:31:32Z</dc:date>
    </item>
  </channel>
</rss>

