<?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: CALCULATE function giving incorrect result when used with a Measure filter condition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-function-giving-incorrect-result-when-used-with-a/m-p/3102392#M109142</link>
    <description>&lt;P&gt;Should be something like the following...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure =
VAR TotalIterations = SUMX(Table, [Iterations])
VAR TotalIterationsNonCompliance = SUMX(SUMMARIZE(Table,TicketNumber,"NewMeasure",COUNTAX(Filter(Table, Minutes&amp;gt;=1400),Ticketnumber),[NewMeasure])


RETURN DIVIDE(TotalIterationsNonCompliance ,TotalIterations ,0)&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 27 Feb 2023 20:48:59 GMT</pubDate>
    <dc:creator>BrianConnelly</dc:creator>
    <dc:date>2023-02-27T20:48:59Z</dc:date>
    <item>
      <title>CALCULATE function giving incorrect result when used with a Measure filter condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-function-giving-incorrect-result-when-used-with-a/m-p/3089163#M108124</link>
      <description>&lt;P&gt;I have a dataset that has ticket numbers with multiple iterations for each ticket and each iteration has multiple stages.&lt;/P&gt;&lt;P&gt;Time duration in minutes is captured at each stage and each iteration.&lt;/P&gt;&lt;P&gt;I have a business rule saying if the ticket is stuck at any iteration for more than 24 hours (Including all stages) then its flagged as 'Non Compliance' and under 24 hours then 'Complaince'.&lt;/P&gt;&lt;P&gt;So in the below example ticket , there are 8 iterations and I have calculated the total number of minutes at each iteration using the measure SLA Minutes.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Created another measure SLA Result to check if that iteration is in Compliance or Non Complaince.&lt;/P&gt;&lt;P&gt;Iterations = Count of distinct Iterations&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SLA minutes = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;wwlp_statustimerecorder&lt;/SPAN&gt;&lt;SPAN&gt;[StatusMinutes]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SLA Result = &lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[SLA minutes ]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN&gt;1440&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"Complaince"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"Non Complaince"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Now I need to calculate the % of complaince SLA which is Total # of iterations with complaince SLA divided by Total # of iterations.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;for this I first created the below Measure&amp;nbsp;ComplianceSLA to get the # of Complaince SLA iterations.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ComplianceSLA = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Iterations]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;wwlp_statustimerecorder&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;[SLA Result]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"Complaince"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Initially tried without FILTER function in the CALCULATE function &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;As we can see there are 8 iterations for this ticket # and 2 are in compliance rest 6 are Non Compliance.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But the&amp;nbsp;ComplianceSLA measure is giving me wrong answer as 7 instead of 2.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Could you please advice me where am I doing wrong and how to get the correct result.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 02:01:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-function-giving-incorrect-result-when-used-with-a/m-p/3089163#M108124</guid>
      <dc:creator>narsimha</dc:creator>
      <dc:date>2023-02-21T02:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE function giving incorrect result when used with a Measure filter condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-function-giving-incorrect-result-when-used-with-a/m-p/3089408#M108150</link>
      <description>&lt;P&gt;Is [&lt;SPAN&gt;SLA Result] a calculated column or a measure?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If it is a measure, then you need to work with Summarize functions.&amp;nbsp; Let me know and I can help you here, but need more details in what you created.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 04:33:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-function-giving-incorrect-result-when-used-with-a/m-p/3089408#M108150</guid>
      <dc:creator>BrianConnelly</dc:creator>
      <dc:date>2023-02-21T04:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE function giving incorrect result when used with a Measure filter condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-function-giving-incorrect-result-when-used-with-a/m-p/3089473#M108160</link>
      <description>&lt;P&gt;Yes SLA Result is a Measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please Let me know how i can achive this? also let me know what details you need.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 05:33:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-function-giving-incorrect-result-when-used-with-a/m-p/3089473#M108160</guid>
      <dc:creator>narsimha</dc:creator>
      <dc:date>2023-02-21T05:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE function giving incorrect result when used with a Measure filter condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-function-giving-incorrect-result-when-used-with-a/m-p/3102392#M109142</link>
      <description>&lt;P&gt;Should be something like the following...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure =
VAR TotalIterations = SUMX(Table, [Iterations])
VAR TotalIterationsNonCompliance = SUMX(SUMMARIZE(Table,TicketNumber,"NewMeasure",COUNTAX(Filter(Table, Minutes&amp;gt;=1400),Ticketnumber),[NewMeasure])


RETURN DIVIDE(TotalIterationsNonCompliance ,TotalIterations ,0)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 27 Feb 2023 20:48:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-function-giving-incorrect-result-when-used-with-a/m-p/3102392#M109142</guid>
      <dc:creator>BrianConnelly</dc:creator>
      <dc:date>2023-02-27T20:48:59Z</dc:date>
    </item>
  </channel>
</rss>

