<?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 Slow DAX with a variable in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slow-DAX-with-a-variable/m-p/679775#M428</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've come across now several times and issue in performance when I use a variable, and it's odd because I had issue or large table, but recently on a new project I've used it on a small table and the same issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The DAX should simply display results for each month (1 year only) and filter the data using month max date.&lt;/P&gt;&lt;P&gt;Simple, but it takes over 40 seconds with a variable and when I try date (which only works for 1 month) is very fast.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've also try to combine date function with max (code below), just too see if there is a difference. No difference, still slow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see below DAX example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Test Measure =&lt;BR /&gt;var SlowOver40sec = max(DimDate[Date]) + 1&lt;BR /&gt;var SlowTooOver40sec = DATE(2019,month(max(DimDate[Date])+ 1 ),1)&lt;BR /&gt;var FastBelow1sec = DATE(2019,4,1)&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(SUMX('Historical Table',1)&lt;BR /&gt;,'Historical Table'[ChangeDateTime]&amp;lt; FastBelow1sec&lt;BR /&gt;,all(DimDate))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any explanation of why it's so slow with a variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Apr 2019 09:51:03 GMT</pubDate>
    <dc:creator>katieandemil</dc:creator>
    <dc:date>2019-04-29T09:51:03Z</dc:date>
    <item>
      <title>Slow DAX with a variable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slow-DAX-with-a-variable/m-p/679775#M428</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've come across now several times and issue in performance when I use a variable, and it's odd because I had issue or large table, but recently on a new project I've used it on a small table and the same issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The DAX should simply display results for each month (1 year only) and filter the data using month max date.&lt;/P&gt;&lt;P&gt;Simple, but it takes over 40 seconds with a variable and when I try date (which only works for 1 month) is very fast.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've also try to combine date function with max (code below), just too see if there is a difference. No difference, still slow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see below DAX example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Test Measure =&lt;BR /&gt;var SlowOver40sec = max(DimDate[Date]) + 1&lt;BR /&gt;var SlowTooOver40sec = DATE(2019,month(max(DimDate[Date])+ 1 ),1)&lt;BR /&gt;var FastBelow1sec = DATE(2019,4,1)&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(SUMX('Historical Table',1)&lt;BR /&gt;,'Historical Table'[ChangeDateTime]&amp;lt; FastBelow1sec&lt;BR /&gt;,all(DimDate))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any explanation of why it's so slow with a variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 09:51:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slow-DAX-with-a-variable/m-p/679775#M428</guid>
      <dc:creator>katieandemil</dc:creator>
      <dc:date>2019-04-29T09:51:03Z</dc:date>
    </item>
  </channel>
</rss>

