<?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: Dax optimization  - Formula help in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/3310503#M123743</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works perfectly for the current measure, do we use it differently for the other buckets?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Siphiwe&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jun 2023 15:32:05 GMT</pubDate>
    <dc:creator>Siphiwe</dc:creator>
    <dc:date>2023-06-30T15:32:05Z</dc:date>
    <item>
      <title>Dax optimization  - Formula help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/1774538#M37182</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The below logic is taking longer time to execute but giving me the right result though.&lt;BR /&gt;Can anyone tell me where am i going wrong?&lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Apr 2021 13:17:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/1774538#M37182</guid>
      <dc:creator>Akhil_1411</dc:creator>
      <dc:date>2021-04-08T13:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Dax optimization  - Formula help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/1776891#M37258</link>
      <description>&lt;P&gt;Can anyone please help here? Need some of your suggestions please.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 13:09:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/1776891#M37258</guid>
      <dc:creator>Akhil_1411</dc:creator>
      <dc:date>2021-04-09T13:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dax optimization  - Formula help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/1776907#M37260</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="228705" data-lia-user-login="Akhil_1411" class="lia-mention lia-mention-user"&gt;Akhil_1411&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From my reading of your measures, I would recommend changing to a single measure instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reasons for performance issues look to be:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Filtering tables rather than filtering columns. e.g. the two-column table created by ALL or 'DPO BSEG', . It's always best to filter columns individually where possible.&lt;/LI&gt;
&lt;LI&gt;Nesting of FILTERs by evaluating [Overdue Days.] within [0-10 Days aging].&lt;/LI&gt;
&lt;LI&gt;Multiple evaluations of [Overdue Days.]&lt;/LI&gt;
&lt;LI&gt;The SELECTEDVALUE functions on rows 2-3 of [Overdue Days.] are redundant, since if a single value is visible, then it is the maximum value anyway. So you can just use MAX expression for both of these.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is how I would propose to rewrite as a single measure, bearing in mind that I haven't been able to test it in your model:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;0 - 10 Days aging =
VAR DaysAgingMin = 0
VAR DaysAgingMax = 10
VAR _endofmonth =
    MAX ( 'Date Table'[End of the Month] )
VAR _selecteddate =
    MAX ( 'Date Table'[Date] )
VAR DueDateLowerBound = _endofmonth - DaysAgingMax
VAR DueDateUpperBound = _endofmonth - DaysAgingMin
RETURN
    CALCULATE (
        SUM ( 'DPO BSEG'[WRBTR] ),
        KEEPFILTERS (
            'DPO BSEG'[AUGDT] = BLANK ()
            || _selecteddate &amp;lt; 'DPO BSEG'[AUGDT]
        ),
        KEEPFILTERS ( _selecteddate &amp;gt;= 'DPO BSEG'[_Due Date] ),
        KEEPFILTERS ( 'DPO BSEG'[_Due Date] &amp;lt;= DueDateUpperBound ),
        KEEPFILTERS ( 'DPO BSEG'[_Due Date] &amp;gt;= DueDateLowerBound )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;My interpretation of what your original measure (and hopefully this measure) does is this (please correct me if I'm wrong):&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;Calculate the sum of WRBTR where:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;Due Date is on or before Selected Date&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;AND Clearing Date (AUGDT) is either after Selected Date or blank&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;AND Due Date is between 0-10 days before the End of the Month (being the same month as Selected Date)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I have combined the various filter conditions from your original measures into a single measure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this produce the correct result, and does it perform better?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Owen&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 13:17:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/1776907#M37260</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2021-04-09T13:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Dax optimization  - Formula help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/1781747#M37401</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt;&amp;nbsp;, Thanks a lot. I got it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That helps me in understanding where i am going wrong.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 06:51:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/1781747#M37401</guid>
      <dc:creator>Akhil_1411</dc:creator>
      <dc:date>2021-04-13T06:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Dax optimization  - Formula help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/3310503#M123743</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works perfectly for the current measure, do we use it differently for the other buckets?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Siphiwe&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 15:32:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/3310503#M123743</guid>
      <dc:creator>Siphiwe</dc:creator>
      <dc:date>2023-06-30T15:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dax optimization  - Formula help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/3311657#M123830</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="583088" data-lia-user-login="Siphiwe" class="lia-mention lia-mention-user"&gt;Siphiwe&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To generalise this formula to handle all buckets, I would recommend a Dynamic Segmentation pattern.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.daxpatterns.com/dynamic-segmentation/" target="_blank"&gt;https://www.daxpatterns.com/dynamic-segmentation/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A Bucket table should be created with one row per bucket, containing DaysAgingMin and DaysAgingMax columns plus any required naming columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The measure above would then be adjusted to reference DaysAgingMin and DaysAgingMax values from that table.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jul 2023 23:43:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-optimization-Formula-help/m-p/3311657#M123830</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2023-07-02T23:43:37Z</dc:date>
    </item>
  </channel>
</rss>

