<?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 DAX Measure Optimization - Please help in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4919639#M186791</link>
    <description>&lt;P&gt;Hi All.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help me optimize this measure, the goal is an optimized version of this measure that&amp;nbsp;&lt;STRONG&gt;improves performance&lt;/STRONG&gt;&amp;nbsp;while maintaining the same calculation logic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Measure to be optimized:&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CY Periodical - OMNI - # Actual Covering Agents =&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;VAR _KPIKey = 271&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;VAR _Table =&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CALCULATETABLE (&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SUMMARIZECOLUMNS (&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FactProductivity[FiscalMonth],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FactProductivity[CustomerKey],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"@Covered Outlets",&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CALCULATE (&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[CY Periodical Generic - Productivity - DCount LastEmployeeKey],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;KEEPFILTERS ( DimKPI[KPIKey] = _KPIKey )&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;RETURN&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SUMX ( _Table, [@Covered Outlets] )&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I came to those two as solution for optimization:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution A:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;CY Periodical - OMNI - # Actual Covering Agents =&lt;/P&gt;&lt;P&gt;VAR _KPIKey = 271&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;CALCULATE (&lt;/P&gt;&lt;P&gt;SUMX (&lt;/P&gt;&lt;P&gt;SUMMARIZECOLUMNS (&lt;/P&gt;&lt;P&gt;FactProductivity[FiscalMonth],&lt;/P&gt;&lt;P&gt;FactProductivity[CustomerKey]&lt;/P&gt;&lt;P&gt;),&lt;/P&gt;&lt;P&gt;CALCULATE (&lt;/P&gt;&lt;P&gt;[CY Periodical Generic - Productivity - DCount LastEmployeeKey]&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;),&lt;/P&gt;&lt;P&gt;KEEPFILTERS ( DimKPI[KPIKey] = _KPIKey )&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution B:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CY Periodical - OMNI - # Actual Covering Agents =&lt;/P&gt;&lt;P&gt;VAR _KPIKey = 271&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;SUMX (&lt;/P&gt;&lt;P&gt;SUMMARIZECOLUMNS (&lt;/P&gt;&lt;P&gt;FactProductivity[FiscalMonth],&lt;/P&gt;&lt;P&gt;FactProductivity[CustomerKey],&lt;/P&gt;&lt;P&gt;KEEPFILTERS ( TREATAS ( { _KPIKey }, DimKPI[KPIKey] ) ),&lt;/P&gt;&lt;P&gt;"Covered",&lt;/P&gt;&lt;P&gt;[CY Periodical Generic - Productivity - DCount LastEmployeeKey]&lt;/P&gt;&lt;P&gt;),&lt;/P&gt;&lt;P&gt;[Covered]&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you think any of my Solutions would provide an optimized version of this measure that improves performance while maintaining the same calculation logic. ? I have tested both Options and they work great in terms of whether the data is correct in my report, but the question is if there is even better solution or which of the two is the best in terms of the optimization that I am looking for.&lt;/P&gt;&lt;P&gt;This is something that my Boss gave me as a task and the help would be much appreciated!&lt;BR /&gt;&lt;BR /&gt;EDIT: I forgot to put the measure which is referenced in the measure that needs to be optimized, I believe it would be helpful, here it is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;CY Periodical Generic - Productivity - DCount LastEmployeeKey = DISTINCTCOUNTNOBLANK ( FactProductivity[FSOLastEmployeeKey] )&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jan 2026 17:25:27 GMT</pubDate>
    <dc:creator>NRF95</dc:creator>
    <dc:date>2026-01-16T17:25:27Z</dc:date>
    <item>
      <title>DAX Measure Optimization - Please help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4919639#M186791</link>
      <description>&lt;P&gt;Hi All.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help me optimize this measure, the goal is an optimized version of this measure that&amp;nbsp;&lt;STRONG&gt;improves performance&lt;/STRONG&gt;&amp;nbsp;while maintaining the same calculation logic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Measure to be optimized:&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CY Periodical - OMNI - # Actual Covering Agents =&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;VAR _KPIKey = 271&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;VAR _Table =&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CALCULATETABLE (&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SUMMARIZECOLUMNS (&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FactProductivity[FiscalMonth],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FactProductivity[CustomerKey],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"@Covered Outlets",&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CALCULATE (&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[CY Periodical Generic - Productivity - DCount LastEmployeeKey],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;KEEPFILTERS ( DimKPI[KPIKey] = _KPIKey )&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;RETURN&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SUMX ( _Table, [@Covered Outlets] )&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I came to those two as solution for optimization:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution A:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;CY Periodical - OMNI - # Actual Covering Agents =&lt;/P&gt;&lt;P&gt;VAR _KPIKey = 271&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;CALCULATE (&lt;/P&gt;&lt;P&gt;SUMX (&lt;/P&gt;&lt;P&gt;SUMMARIZECOLUMNS (&lt;/P&gt;&lt;P&gt;FactProductivity[FiscalMonth],&lt;/P&gt;&lt;P&gt;FactProductivity[CustomerKey]&lt;/P&gt;&lt;P&gt;),&lt;/P&gt;&lt;P&gt;CALCULATE (&lt;/P&gt;&lt;P&gt;[CY Periodical Generic - Productivity - DCount LastEmployeeKey]&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;),&lt;/P&gt;&lt;P&gt;KEEPFILTERS ( DimKPI[KPIKey] = _KPIKey )&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution B:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CY Periodical - OMNI - # Actual Covering Agents =&lt;/P&gt;&lt;P&gt;VAR _KPIKey = 271&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;SUMX (&lt;/P&gt;&lt;P&gt;SUMMARIZECOLUMNS (&lt;/P&gt;&lt;P&gt;FactProductivity[FiscalMonth],&lt;/P&gt;&lt;P&gt;FactProductivity[CustomerKey],&lt;/P&gt;&lt;P&gt;KEEPFILTERS ( TREATAS ( { _KPIKey }, DimKPI[KPIKey] ) ),&lt;/P&gt;&lt;P&gt;"Covered",&lt;/P&gt;&lt;P&gt;[CY Periodical Generic - Productivity - DCount LastEmployeeKey]&lt;/P&gt;&lt;P&gt;),&lt;/P&gt;&lt;P&gt;[Covered]&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you think any of my Solutions would provide an optimized version of this measure that improves performance while maintaining the same calculation logic. ? I have tested both Options and they work great in terms of whether the data is correct in my report, but the question is if there is even better solution or which of the two is the best in terms of the optimization that I am looking for.&lt;/P&gt;&lt;P&gt;This is something that my Boss gave me as a task and the help would be much appreciated!&lt;BR /&gt;&lt;BR /&gt;EDIT: I forgot to put the measure which is referenced in the measure that needs to be optimized, I believe it would be helpful, here it is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;CY Periodical Generic - Productivity - DCount LastEmployeeKey = DISTINCTCOUNTNOBLANK ( FactProductivity[FSOLastEmployeeKey] )&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2026 17:25:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4919639#M186791</guid>
      <dc:creator>NRF95</dc:creator>
      <dc:date>2026-01-16T17:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure Optimization - Please help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4919657#M186792</link>
      <description>&lt;P&gt;My suggestion would be to make a new meaure out of your calculate statement:&lt;/P&gt;&lt;P&gt;New Measure =&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CALCULATE (&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[CY Periodical Generic - Productivity - DCount LastEmployeeKey],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;KEEPFILTERS ( DimKPI[KPIKey] = _KPIKey )&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe also make a numeric parameter for your KPI key so you can use that value in multiple measures so you don't have to change it all the different places.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once that new meausure is in the model, you can add it to your summarizecolumns statement without declaring the code in there.&amp;nbsp; My guess is that calculate statement inside of the summarizecolumns is what's slowing it down.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2026 17:51:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4919657#M186792</guid>
      <dc:creator>d_m_LNK</dc:creator>
      <dc:date>2026-01-16T17:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure Optimization - Please help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4919723#M186796</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1509998" data-lia-user-login="NRF95" class="lia-mention lia-mention-user"&gt;NRF95&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I hope you are doing well today ☺️&lt;span class="lia-unicode-emoji" title=":red_heart:"&gt;❤️&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So both &lt;STRONG&gt;&lt;FONT size="4" color="#FF0000"&gt;Solutions A and B &lt;/FONT&gt;&lt;/STRONG&gt;return correct results but from a performance and best practice DAX POV ,&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Solution B is strongest and more optimized approach&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5" color="#99CC00"&gt;&lt;STRONG&gt;Let me Explain it for you&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;First Approach (A Solution)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;While A is a Good approach but it still introduces unnecessary overhead Like:&lt;UL&gt;&lt;LI&gt;&lt;P&gt;It relies on a &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;CALCULATE&lt;/FONT&gt; &lt;/STRONG&gt;inside &lt;FONT color="#FF0000"&gt;SUMX&amp;nbsp;&lt;/FONT&gt;which causes repeated context transitions (Not ideal for Performance)&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;The KPI filter is applied &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;outside the iterator&lt;/STRONG&gt;&lt;/FONT&gt; meaning it will reevaluate for each row group&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;In short it will &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;produce more Formula Engine work&lt;/STRONG&gt;&lt;/FONT&gt; than needed&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="4" color="#99CC00"&gt;&lt;STRONG&gt;Second Approach (B Solution) - Better Solution&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;This Solution improves performance in several important ways like:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;The KPI filter is pushed inside &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;SUMMARIZECOLUMNS&lt;/STRONG&gt; &lt;/FONT&gt;allowing it to be applied once and early&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;It avoids nested &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;CALCULATE&lt;/STRONG&gt; &lt;/FONT&gt;calls inside &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;iterators&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;SUMMARIZECOLUMNS&lt;/STRONG&gt; &lt;/FONT&gt;is well optimized by the engine (for &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;grouping&lt;/STRONG&gt; &lt;/FONT&gt;and &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;measure evaluation&lt;/STRONG&gt;&lt;/FONT&gt;)&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;This is best for &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;reducing context transitions&lt;/STRONG&gt;&lt;/FONT&gt; and &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;improves Engine efficiency&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;In Short &lt;FONT size="4" color="#FF0000"&gt;&lt;STRONG&gt;Approach B&lt;/STRONG&gt;&lt;/FONT&gt; is &lt;FONT color="#339966"&gt;&lt;STRONG&gt;both cleaner and faster&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;while doing the &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;exact calculation logic&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#FFCC00"&gt;Final Recommendation:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Do this if there is a relationship between &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;DimKPI&lt;/STRONG&gt; &lt;/FONT&gt;and &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;FactProductivity &lt;/FONT&gt;&lt;/STRONG&gt;this final version is more clean and well performed:&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="markup"&gt;CY Periodical - OMNI - # Actual Covering Agents =
VAR _KPIKey = 271
RETURN
SUMX(
    SUMMARIZECOLUMNS(
        FactProductivity[FiscalMonth],
        FactProductivity[CustomerKey],
        KEEPFILTERS ( DimKPI[KPIKey] = _KPIKey ),
        "Covered",
        [CY Periodical Generic - Productivity - DCount LastEmployeeKey]
    ),
    [Covered]
)&lt;/LI-CODE&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT size="4" color="#FF0000"&gt;If there is no relationship&lt;/FONT&gt; between them then Solution B using &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;TREATAS&lt;/FONT&gt; &lt;/STRONG&gt;is the correct and optimized&lt;/LI&gt;&lt;/UL&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;EM&gt;if this post helps, then I would appreciate a thumbs up&lt;/EM&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;and&amp;nbsp;&lt;STRONG&gt;mark it as the solution&lt;/STRONG&gt;&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;to help the other members find it more quickly.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Jan 2026 22:22:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4919723#M186796</guid>
      <dc:creator>Ahmed-Elfeel</dc:creator>
      <dc:date>2026-01-16T22:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure Optimization - Please help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4919838#M186800</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1509998" data-lia-user-login="NRF95" class="lia-mention lia-mention-user"&gt;NRF95&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;STRONG&gt;First, What your original measure is really doing?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Your original measure:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Creates a virtual table grouped by&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;FiscalMonth × CustomerKey&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;For each group, evaluates&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;DISTINCTCOUNTNOBLANK ( FSOLastEmployeeKey )&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Applies KPIKey = 271&lt;/LI&gt;&lt;LI&gt;Then SUMX over the virtual table&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;So the expensive parts are:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;CALCULATETABLE + SUMMARIZECOLUMNS&lt;/LI&gt;&lt;LI&gt;Nested CALCULATE&lt;/LI&gt;&lt;LI&gt;Row-by-row SUMX&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;Evaluation of your solutions&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Solution A - Why it’s NOT optimal?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Forces context transition inside SUMX&lt;/LI&gt;&lt;LI&gt;DISTINCTCOUNT is re-evaluated row by row&lt;/LI&gt;&lt;LI&gt;Filter is applied outside, not pushed into the grouping&lt;/LI&gt;&lt;LI&gt;Works logically, but worst engine plan of the 3&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Solution B - Why this is better?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;KPI filter pushed inside SUMMARIZECOLUMNS&lt;/LI&gt;&lt;LI&gt;No nested CALCULATE per row&lt;/LI&gt;&lt;LI&gt;Cleaner filter propagation&lt;/LI&gt;&lt;LI&gt;Better storage engine utilization&lt;/LI&gt;&lt;LI&gt;Solution B is clearly better than A&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Best Optimized Version (Better than both):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You can remove the virtual column entirely and let the engine aggregate directly:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;---DAX---&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;CY Periodical - OMNI - # Actual Covering Agents :=&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;CALCULATE (&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;SUMX (&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;SUMMARIZECOLUMNS (&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;FactProductivity[FiscalMonth],&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;FactProductivity[CustomerKey]&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;),&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;DISTINCTCOUNTNOBLANK ( FactProductivity[FSOLastEmployeeKey] )&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;),&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;DimKPI[KPIKey] = 271&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;---DAX---&lt;/EM&gt;&lt;BR /&gt;&lt;STRONG&gt;Why this is the best?&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;No nested CALCULATE&lt;/LI&gt;&lt;LI&gt;No calculated column inside SUMMARIZE&lt;/LI&gt;&lt;LI&gt;KPI filter applied once&lt;/LI&gt;&lt;LI&gt;Storage Engine can optimize DISTINCTCOUNT&lt;/LI&gt;&lt;LI&gt;Same logic, fewer formula engine calls&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Solution A → logically correct, performance regression&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Solution B → better, safe improvement&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Final version above → best optimized, same logic, best engine plan&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;=================================================================&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution!&lt;/STRONG&gt;&lt;/EM&gt; This will help others on the forum!&lt;/P&gt;&lt;P&gt;Appreciate your Kudos!!&lt;/P&gt;&lt;P&gt;Jaywant Thorat | MCT | Data Analytics Coach&lt;BR /&gt;LinkedIn: &lt;A href="https://www.linkedin.com/in/jaywantthorat/" target="_blank"&gt;https://www.linkedin.com/in/jaywantthorat/&lt;/A&gt;&lt;BR /&gt;Join #MissionPowerBIBharat =&amp;nbsp;&lt;A href="https://shorturl.at/5ViW9" target="_blank"&gt;https://shorturl.at/5ViW9&lt;/A&gt;&lt;BR /&gt;#MissionPowerBIBharat&lt;BR /&gt;LIVE with Jaywant Thorat from 10 Jan 2026&lt;BR /&gt;8 Days | 8 Sessions | 1 hr daily | 100% Free&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jan 2026 08:39:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4919838#M186800</guid>
      <dc:creator>Jaywant-Thorat</dc:creator>
      <dc:date>2026-01-17T08:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure Optimization - Please help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4920619#M186812</link>
      <description>&lt;P&gt;Hi Sir, Thank you for your reply! There is indeed a relationship between DimKPI and FactProductivity via key "KPIKey". However, when I use the version that you suggested I received the following error &lt;EM&gt;"A single value for column 'KPIKey' in table 'DimKPI' cannot be determined. This can happen when a measure or function formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;This is fine though, I will use the TRETAS measure that you confirmed is definitely the best alternative to the original measure. Thanks a lot again!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jan 2026 09:16:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4920619#M186812</guid>
      <dc:creator>NRF95</dc:creator>
      <dc:date>2026-01-19T09:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure Optimization - Please help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4921126#M186821</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1509998" data-lia-user-login="NRF95" class="lia-mention lia-mention-user"&gt;NRF95&lt;/a&gt;,&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;EM&gt;if my reply helps, then I would appreciate&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;&lt;STRONG&gt;mark it as the solution&lt;/STRONG&gt;&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;to help the other members find it more quickly.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 19 Jan 2026 17:38:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-Optimization-Please-help/m-p/4921126#M186821</guid>
      <dc:creator>Ahmed-Elfeel</dc:creator>
      <dc:date>2026-01-19T17:38:07Z</dc:date>
    </item>
  </channel>
</rss>

