<?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 calculate expression which use another measure calculation to filter those long than X days in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-expression-which-use-another-measure-calculation-to/m-p/3302353#M157425</link>
    <description>&lt;P&gt;Hi everyone I have an issue which I'm sure is simple but I cannot get it to work.&amp;nbsp; (as our dataset is huge and not easy for me to scrub some data out off ill try and explain.&lt;BR /&gt;&lt;BR /&gt;Currently we have a table &lt;FONT color="#0000FF"&gt;iv_fact_ticketsall.&lt;/FONT&gt;&amp;nbsp; This is the fact table for out ITSM tool.&amp;nbsp; It has large number of dimensions&amp;nbsp;and some other fact tables associated&amp;nbsp;with it.&amp;nbsp; One of them contains every status the ticket has been assigned at some point and the length it was on.&amp;nbsp; This is called &lt;FONT color="#0000FF"&gt;IV_Fact_TicketChange&lt;FONT color="#000000"&gt;.&amp;nbsp; &amp;nbsp;Now I have a measure &lt;FONT color="#339966"&gt;&lt;EM&gt;_StatusLength(Minutes)&lt;/EM&gt;&lt;/FONT&gt; in &lt;FONT color="#0000FF"&gt;IV_Fact_TicketChange&lt;/FONT&gt; which works out the length of each status based on &lt;FONT color="#339966"&gt;&lt;EM&gt;BeginDateTime&lt;/EM&gt;&lt;/FONT&gt; &amp;amp; &lt;FONT color="#339966"&gt;&lt;EM&gt;EndDateTime&lt;/EM&gt;&lt;/FONT&gt; fields.&amp;nbsp; With some dax to takeout weekends and bankholidays.&amp;nbsp; &amp;nbsp;Inside that table there is also a field &lt;FONT color="#339966"&gt;&lt;EM&gt;TicketStatusSK&lt;/EM&gt;&lt;/FONT&gt;. Which holds the status.&amp;nbsp; Both tables are linked by the reference&amp;nbsp;number&amp;nbsp; (&lt;FONT color="#339966"&gt;&lt;EM&gt;TicketNumber&lt;/EM&gt;&lt;/FONT&gt;) so each row in &lt;FONT color="#0000FF"&gt;iv_fact_ticketsall&lt;/FONT&gt; table would have multiple entries in the &lt;FONT color="#0000FF"&gt;iv_fact_ticketchange&lt;/FONT&gt;.&lt;BR /&gt;&lt;BR /&gt;I need to get total length of a ticket.&amp;nbsp; Based on combination of certain status's and w&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;hich is less than 5 days or in my case 7200 minutes.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Now I can do this easily as create calculated column:-&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;EM&gt;CALCULATE(SUM(IV_fact_TicketChange[_StatusLength(Minutes)]),&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;IV_fact_TicketChange[TicketStatusSK] in {"Resolved","Closed","Fulfilled"})&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;&lt;BR /&gt;Then use this with in my measure to aggregate&amp;nbsp;down all the rows which are &amp;lt;= 5 days. then divide this by the total number of tickets for a given month. Such as: -&amp;nbsp;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;EM&gt;_KPI1 =&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;VAR&lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt; _TicketsinSLA =&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; CALCULATE (&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [_TicketsCount], //This is measure to count number of rows in IV_Fact_TicketsAll Table)&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IV_dim_ReportedCategory[ReportedCategoryNameSK] IN {"Amend Existing User Account","Delete or Disable User Account","New User Account","New User Account with Hardware"},&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;IV_fact_TicketsAll[TotalTime(Minutes)] &amp;lt;=7200&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; )&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;VAR _TotalTickets = &lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; CALCULATE (&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [_TicketsCount],&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IV_dim_ReportedCategory[ReportedCategoryNameSK] IN {"Amend Existing User Account","Delete or Disable User Account","New User Account","New User Account with Hardware"}&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; )&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;RETURN&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;DIVIDE (&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_TicketsinSLA,&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_TotalTickets,&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;&lt;BR /&gt;However in this instance I need to create it in the\a measure used in a calculation&amp;nbsp;for KPI.&amp;nbsp; (Unfortunately&amp;nbsp;for this one particular KPI they only want to count certain&amp;nbsp;status and as its not need other areas I rather it was not a calculated&amp;nbsp;column.)&amp;nbsp; I'm sure this is pretty Simple but cannot get it to work&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jun 2023 14:43:33 GMT</pubDate>
    <dc:creator>AdrianLock</dc:creator>
    <dc:date>2023-06-26T14:43:33Z</dc:date>
    <item>
      <title>calculate expression which use another measure calculation to filter those long than X days</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-expression-which-use-another-measure-calculation-to/m-p/3302353#M157425</link>
      <description>&lt;P&gt;Hi everyone I have an issue which I'm sure is simple but I cannot get it to work.&amp;nbsp; (as our dataset is huge and not easy for me to scrub some data out off ill try and explain.&lt;BR /&gt;&lt;BR /&gt;Currently we have a table &lt;FONT color="#0000FF"&gt;iv_fact_ticketsall.&lt;/FONT&gt;&amp;nbsp; This is the fact table for out ITSM tool.&amp;nbsp; It has large number of dimensions&amp;nbsp;and some other fact tables associated&amp;nbsp;with it.&amp;nbsp; One of them contains every status the ticket has been assigned at some point and the length it was on.&amp;nbsp; This is called &lt;FONT color="#0000FF"&gt;IV_Fact_TicketChange&lt;FONT color="#000000"&gt;.&amp;nbsp; &amp;nbsp;Now I have a measure &lt;FONT color="#339966"&gt;&lt;EM&gt;_StatusLength(Minutes)&lt;/EM&gt;&lt;/FONT&gt; in &lt;FONT color="#0000FF"&gt;IV_Fact_TicketChange&lt;/FONT&gt; which works out the length of each status based on &lt;FONT color="#339966"&gt;&lt;EM&gt;BeginDateTime&lt;/EM&gt;&lt;/FONT&gt; &amp;amp; &lt;FONT color="#339966"&gt;&lt;EM&gt;EndDateTime&lt;/EM&gt;&lt;/FONT&gt; fields.&amp;nbsp; With some dax to takeout weekends and bankholidays.&amp;nbsp; &amp;nbsp;Inside that table there is also a field &lt;FONT color="#339966"&gt;&lt;EM&gt;TicketStatusSK&lt;/EM&gt;&lt;/FONT&gt;. Which holds the status.&amp;nbsp; Both tables are linked by the reference&amp;nbsp;number&amp;nbsp; (&lt;FONT color="#339966"&gt;&lt;EM&gt;TicketNumber&lt;/EM&gt;&lt;/FONT&gt;) so each row in &lt;FONT color="#0000FF"&gt;iv_fact_ticketsall&lt;/FONT&gt; table would have multiple entries in the &lt;FONT color="#0000FF"&gt;iv_fact_ticketchange&lt;/FONT&gt;.&lt;BR /&gt;&lt;BR /&gt;I need to get total length of a ticket.&amp;nbsp; Based on combination of certain status's and w&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;hich is less than 5 days or in my case 7200 minutes.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Now I can do this easily as create calculated column:-&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;EM&gt;CALCULATE(SUM(IV_fact_TicketChange[_StatusLength(Minutes)]),&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;IV_fact_TicketChange[TicketStatusSK] in {"Resolved","Closed","Fulfilled"})&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;&lt;BR /&gt;Then use this with in my measure to aggregate&amp;nbsp;down all the rows which are &amp;lt;= 5 days. then divide this by the total number of tickets for a given month. Such as: -&amp;nbsp;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;EM&gt;_KPI1 =&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;VAR&lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt; _TicketsinSLA =&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; CALCULATE (&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [_TicketsCount], //This is measure to count number of rows in IV_Fact_TicketsAll Table)&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IV_dim_ReportedCategory[ReportedCategoryNameSK] IN {"Amend Existing User Account","Delete or Disable User Account","New User Account","New User Account with Hardware"},&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;IV_fact_TicketsAll[TotalTime(Minutes)] &amp;lt;=7200&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; )&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;VAR _TotalTickets = &lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; CALCULATE (&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [_TicketsCount],&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IV_dim_ReportedCategory[ReportedCategoryNameSK] IN {"Amend Existing User Account","Delete or Disable User Account","New User Account","New User Account with Hardware"}&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; )&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;RETURN&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp;DIVIDE (&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_TicketsinSLA,&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_TotalTickets,&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;&lt;BR /&gt;However in this instance I need to create it in the\a measure used in a calculation&amp;nbsp;for KPI.&amp;nbsp; (Unfortunately&amp;nbsp;for this one particular KPI they only want to count certain&amp;nbsp;status and as its not need other areas I rather it was not a calculated&amp;nbsp;column.)&amp;nbsp; I'm sure this is pretty Simple but cannot get it to work&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 14:43:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-expression-which-use-another-measure-calculation-to/m-p/3302353#M157425</guid>
      <dc:creator>AdrianLock</dc:creator>
      <dc:date>2023-06-26T14:43:33Z</dc:date>
    </item>
  </channel>
</rss>

