<?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: Directquery limitation summarize in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Directquery-limitation-summarize/m-p/3630643#M140418</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have made the corresponding tests and different variations in the code. However, the result obtained in the query is blank.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;When testing and validating what the code does in the dwh I see that it creates the following:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The problem observed with this metric is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;It does not consider the date filter, so the sum and count have them over the entire base.&lt;/LI&gt;&lt;LI&gt;Although it returns two values, in Power BI it does not display them but leaves them&amp;nbsp;&lt;STRONG&gt;blank&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;It is not applying the average filter either, so even when modifying the metric it is not generating the correct values.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Thank you very much for your collaboration, in case of any other suggestions I will be very attentive.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jan 2024 13:54:36 GMT</pubDate>
    <dc:creator>jaime_parra</dc:creator>
    <dc:date>2024-01-10T13:54:36Z</dc:date>
    <item>
      <title>Directquery limitation summarize</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Directquery-limitation-summarize/m-p/3618247#M139881</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Context:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have a table with 7 billion rows in bigquery, the table is partitioned and clustered and performs well when sending queries.&lt;/P&gt;&lt;P&gt;I'm trying to get the number of unique users based on a certain condition and the following SQL syntax works perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECT
  COUNT(DISTINCT users) AS cnt_users
FROM (
  SELECT
    users,
    AVG(transactions) AS transactions
  FROM
    `project.dataset.canales`
  WHERE
    Date BETWEEN '2023-10-01' AND '2023-11-05'
  GROUP BY
    users)
WHERE
  transactions BETWEEN 15 AND 25;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;The result is one row with the value and the query runs in 2-3 seconds.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When translate this query to dax:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;light_users = 
VAR _users =
    SUMMARIZECOLUMNS (
        canales[users],
        "avg_trx", AVERAGE ( canales[transactions] )
    )
VAR _filter =
    FILTER ( _users, [avg_trx] &amp;gt;= 15 &amp;amp;&amp;amp; [avg_trx] &amp;lt;= 25 )
RETURN
    COUNTROWS ( _filter )&lt;/LI-CODE&gt;&lt;P&gt;The result in power bi is&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Looking at the query created by Dax in bigquery I can see that Dax created a temp table but the quantity is 1+ million records&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table returns to Power BI to make the final calculation.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So, How can I calculate all directly in the source and solve the problem with the returned rows?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using vars, without vars and nothing works for me.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2024 16:34:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Directquery-limitation-summarize/m-p/3618247#M139881</guid>
      <dc:creator>jaime_parra</dc:creator>
      <dc:date>2024-01-05T16:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Directquery limitation summarize</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Directquery-limitation-summarize/m-p/3618326#M139884</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="669986" data-lia-user-login="jaime_parra" class="lia-mention lia-mention-user"&gt;jaime_parra&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try without variables&lt;/P&gt;
&lt;P&gt;light_users =&lt;BR /&gt;COUNTROWS (&lt;BR /&gt;FILTER (&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;Cancels,&lt;BR /&gt;canales[users],&lt;BR /&gt;"@avg_trx", AVERAGE ( canales[transactions] )&lt;BR /&gt;),&lt;BR /&gt;[@avg_trx] &amp;gt;= 15&lt;BR /&gt;&amp;amp;&amp;amp; [@avg_trx] &amp;lt;= 25&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2024 17:14:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Directquery-limitation-summarize/m-p/3618326#M139884</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-01-05T17:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Directquery limitation summarize</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Directquery-limitation-summarize/m-p/3618338#M139885</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I told you that I did the test with the DAX you sent me and it still generates the same in the data source. So the problem persists.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2024 17:20:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Directquery-limitation-summarize/m-p/3618338#M139885</guid>
      <dc:creator>jaime_parra</dc:creator>
      <dc:date>2024-01-05T17:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Directquery limitation summarize</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Directquery-limitation-summarize/m-p/3624876#M140142</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="669986" data-lia-user-login="jaime_parra" class="lia-mention lia-mention-user"&gt;jaime_parra&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your DAX expression, you are using &lt;STRONG&gt;SUMMARIZECOLUMNS&lt;/STRONG&gt;, which may generate intermediate tables with detailed information for subsequent calculations. In some cases, this can lead to poor performance, especially when working with large datasets.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;One way to optimize DAX queries is to use a combination of &lt;STRONG&gt;CALCULATETABLE&lt;/STRONG&gt; and &lt;STRONG&gt;VALUES&lt;/STRONG&gt;. the idea is to create a filtered table directly in the source and reduce the number of rows before bringing it into Power BI for the final computation.&lt;/P&gt;
&lt;P&gt;Try formula like below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;light_users = 
CALCULATE (
    COUNTROWS (
        VALUES ( canales[users] )
    ),
    FILTER (
        ALL ( canales ),
        canales[Date] &amp;gt;= DATE ( 2023, 10, 1 ) &amp;amp;&amp;amp;
        canales[Date] &amp;lt;= DATE ( 2023, 11, 5 ) &amp;amp;&amp;amp;
        AVERAGE ( canales[transactions] ) &amp;gt;= 15 &amp;amp;&amp;amp;
        AVERAGE ( canales[transactions] ) &amp;lt;= 25
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;EM&gt;&lt;STRONG&gt; Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 06:49:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Directquery-limitation-summarize/m-p/3624876#M140142</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-09T06:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Directquery limitation summarize</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Directquery-limitation-summarize/m-p/3630643#M140418</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have made the corresponding tests and different variations in the code. However, the result obtained in the query is blank.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;When testing and validating what the code does in the dwh I see that it creates the following:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The problem observed with this metric is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;It does not consider the date filter, so the sum and count have them over the entire base.&lt;/LI&gt;&lt;LI&gt;Although it returns two values, in Power BI it does not display them but leaves them&amp;nbsp;&lt;STRONG&gt;blank&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;It is not applying the average filter either, so even when modifying the metric it is not generating the correct values.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Thank you very much for your collaboration, in case of any other suggestions I will be very attentive.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 13:54:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Directquery-limitation-summarize/m-p/3630643#M140418</guid>
      <dc:creator>jaime_parra</dc:creator>
      <dc:date>2024-01-10T13:54:36Z</dc:date>
    </item>
  </channel>
</rss>

