<?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 how to prepare measure that relates to a &amp;quot;temp table&amp;quot; in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-prepare-measure-that-relates-to-a-quot-temp-table-quot/m-p/3136665#M111818</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have problem to prepare calulation in PBI that gives me the same result like simple sql code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;SELECT clid&lt;BR /&gt;into #qs"&lt;BR /&gt;FROM queue_stats_mv &lt;BR /&gt;where date between &lt;SPAN&gt;StartDate and EndDate&lt;/SPAN&gt;&lt;BR /&gt;group by clid&lt;BR /&gt;having count(distinct datetime)&amp;gt;1&lt;BR /&gt;&lt;BR /&gt;select count(*)&lt;BR /&gt;from queue_stats_mv &lt;BR /&gt;where date between &lt;SPAN&gt;StartDate and EndDate and&lt;/SPAN&gt; clid not in (select clid from #qs)&lt;/PRE&gt;&lt;P&gt;I tried calculate something that gives me similary result like temp table #qs using calculatetable and summarize to create new table and define relations between new calculate table and&amp;nbsp;queue_stats_mv but it doesn't work. I need prepare this calculation base on dynamic dates range from date filter in table&amp;nbsp;queue_stats_mv. Any suggestions?&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2023 15:25:47 GMT</pubDate>
    <dc:creator>R0bson</dc:creator>
    <dc:date>2023-03-16T15:25:47Z</dc:date>
    <item>
      <title>how to prepare measure that relates to a "temp table"</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-prepare-measure-that-relates-to-a-quot-temp-table-quot/m-p/3136665#M111818</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have problem to prepare calulation in PBI that gives me the same result like simple sql code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;SELECT clid&lt;BR /&gt;into #qs"&lt;BR /&gt;FROM queue_stats_mv &lt;BR /&gt;where date between &lt;SPAN&gt;StartDate and EndDate&lt;/SPAN&gt;&lt;BR /&gt;group by clid&lt;BR /&gt;having count(distinct datetime)&amp;gt;1&lt;BR /&gt;&lt;BR /&gt;select count(*)&lt;BR /&gt;from queue_stats_mv &lt;BR /&gt;where date between &lt;SPAN&gt;StartDate and EndDate and&lt;/SPAN&gt; clid not in (select clid from #qs)&lt;/PRE&gt;&lt;P&gt;I tried calculate something that gives me similary result like temp table #qs using calculatetable and summarize to create new table and define relations between new calculate table and&amp;nbsp;queue_stats_mv but it doesn't work. I need prepare this calculation base on dynamic dates range from date filter in table&amp;nbsp;queue_stats_mv. Any suggestions?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 15:25:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-prepare-measure-that-relates-to-a-quot-temp-table-quot/m-p/3136665#M111818</guid>
      <dc:creator>R0bson</dc:creator>
      <dc:date>2023-03-16T15:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to prepare measure that relates to a "temp table"</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-prepare-measure-that-relates-to-a-quot-temp-table-quot/m-p/3139830#M112059</link>
      <description>&lt;P&gt;Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot). &lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Mar 2023 00:26:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-prepare-measure-that-relates-to-a-quot-temp-table-quot/m-p/3139830#M112059</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-03-18T00:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to prepare measure that relates to a "temp table"</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-prepare-measure-that-relates-to-a-quot-temp-table-quot/m-p/3140120#M112082</link>
      <description>&lt;P&gt;Hi, thanks for reply.&lt;/P&gt;&lt;P&gt;You can see 2 measures in PBI sample:&lt;BR /&gt;Measure with fixed date range - i put fixed date range in calculatetable and measure and this give me correct result 5082.&lt;BR /&gt;Measure with slicer date range- this is my measure that i need change something to use dynamic date range from slicer.&lt;BR /&gt;I expected the same result as in measure with fixed date range in period: 2023-03-01 - 2023-03-14 but using slicer.&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1arZ4re3DBcxeCGNPeZKNYxdpmDpzbNIQ/view" target="_blank"&gt;https://drive.google.com/file/d/1arZ4re3DBcxeCGNPeZKNYxdpmDpzbNIQ/view&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Mar 2023 10:42:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-prepare-measure-that-relates-to-a-quot-temp-table-quot/m-p/3140120#M112082</guid>
      <dc:creator>R0bson</dc:creator>
      <dc:date>2023-03-18T10:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to prepare measure that relates to a "temp table"</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-prepare-measure-that-relates-to-a-quot-temp-table-quot/m-p/3140163#M112084</link>
      <description>&lt;P&gt;You may be overcomplicating things a bit.&amp;nbsp; Let the data model do the work for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure with slicer date range = 
var a = selectcolumns(CALCULATETABLE(
    Filter(SUMMARIZE(
            queue_stats_mv,
            queue_stats_mv[clid],
            "qty", COUNTROWS(queue_stats_mv)
    ),
    [qty] &amp;gt; 1
    ),
    queue_stats_mv[event] in {"ABAN","AGENT_D"}
    ),"clid",[clid])
return   CALCULATE(
COUNTROWS(queue_stats_mv),
NOT queue_stats_mv[clid] IN a,queue_stats_mv[event] in {"COMPLETE_C","COMPLETE_A"})&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;see attached. I removed all the unnecessary tables and added a necessary dates table.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Mar 2023 12:52:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-prepare-measure-that-relates-to-a-quot-temp-table-quot/m-p/3140163#M112084</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-03-18T12:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to prepare measure that relates to a "temp table"</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-prepare-measure-that-relates-to-a-quot-temp-table-quot/m-p/3140219#M112087</link>
      <description>&lt;P&gt;Thank You very much. Your solution is very simple and&amp;nbsp;efficiency !&lt;/P&gt;</description>
      <pubDate>Sat, 18 Mar 2023 14:40:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-prepare-measure-that-relates-to-a-quot-temp-table-quot/m-p/3140219#M112087</guid>
      <dc:creator>R0bson</dc:creator>
      <dc:date>2023-03-18T14:40:13Z</dc:date>
    </item>
  </channel>
</rss>

