<?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: Multiple If statements in DAX using too many resources in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4164437#M165437</link>
    <description>&lt;P&gt;They are a blend from 2 tables and what if parameters born out of a need for manual intervention&lt;/P&gt;</description>
    <pubDate>Sat, 21 Sep 2024 23:59:01 GMT</pubDate>
    <dc:creator>unknown917</dc:creator>
    <dc:date>2024-09-21T23:59:01Z</dc:date>
    <item>
      <title>Multiple If statements in DAX using too many resources</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4163802#M165412</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a measure with multiple&amp;nbsp; if statements that is crashing my visual.&amp;nbsp; Is there a way to optimize the formula?&amp;nbsp; There are 7 if statements in total, not sure how to break them out into individual measures as they are dependent on each other to produce the end result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF(EG38=1,IF(ABS(EF38)&amp;lt;=$EM$2,EE38,IF(ABS(EF38)&amp;gt;=$EM$2,MIN(208,MAX(EE38,EB38)))),IF(EJ38&amp;lt;$EM$4,104,IF(EK38&amp;lt;$EM$4,52,IF(EL38&amp;lt;$EM$4,26,IF(ABS(EF38)&amp;lt;$EM$2,EE38,IF(ABS(EF38)&amp;gt;$EM$2,MAX(EE38,EB38)))))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions would be greatly appreciated!!!&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2024 11:12:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4163802#M165412</guid>
      <dc:creator>unknown917</dc:creator>
      <dc:date>2024-09-21T11:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statements in DAX using too many resources</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4163810#M165413</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="712480" data-lia-user-login="unknown917" class="lia-mention lia-mention-user"&gt;unknown917&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please share us the column names and measure names because the IF statements you have shared looks like from excel which is using cell reference, and also in DAX make sure you use Switch function which is similar to IF which will be more readable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;U&gt;&lt;STRONG&gt;If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!&lt;/STRONG&gt;&lt;/U&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;Dharmendar S&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.linkedin.com/in/dharmendar-s-b5b43463/" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;LinkedIN&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2024 11:28:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4163810#M165413</guid>
      <dc:creator>dharmendars007</dc:creator>
      <dc:date>2024-09-21T11:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statements in DAX using too many resources</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4163903#M165415</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume you are trying to convert an excel template to a Power BI solution.&lt;/P&gt;&lt;P&gt;Firstly, you can enhance readability of the excel formula to make the logic clearer:&lt;/P&gt;&lt;P&gt;Reference&amp;nbsp;&lt;A title="Reference:" href="https://excel-pratique.com/en/tools/formula-beautifier" target="_blank" rel="noopener"&gt;https://excel-pratique.com/en/tools/formula-beautifier&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;=&lt;SPAN class=""&gt;IF&lt;/SPAN&gt;(&lt;SPAN class=""&gt;EG38&lt;/SPAN&gt; = &lt;SPAN class=""&gt;1&lt;/SPAN&gt;,
    &lt;SPAN class=""&gt;IF&lt;/SPAN&gt;(&lt;SPAN class=""&gt;ABS&lt;/SPAN&gt;(&lt;SPAN class=""&gt;EF38&lt;/SPAN&gt;) &amp;lt;= $EM$&lt;SPAN class=""&gt;2&lt;/SPAN&gt;, &lt;SPAN class=""&gt;EE38&lt;/SPAN&gt;, &lt;SPAN class=""&gt;MIN&lt;/SPAN&gt;(&lt;SPAN class=""&gt;208&lt;/SPAN&gt;, &lt;SPAN class=""&gt;MAX&lt;/SPAN&gt;(&lt;SPAN class=""&gt;EE38&lt;/SPAN&gt;, &lt;SPAN class=""&gt;EB38&lt;/SPAN&gt;))),
    &lt;SPAN class=""&gt;IF&lt;/SPAN&gt;(&lt;SPAN class=""&gt;EJ38&lt;/SPAN&gt; &amp;lt; $EM$&lt;SPAN class=""&gt;4&lt;/SPAN&gt;, &lt;SPAN class=""&gt;104&lt;/SPAN&gt;,
        &lt;SPAN class=""&gt;IF&lt;/SPAN&gt;(&lt;SPAN class=""&gt;EK38&lt;/SPAN&gt; &amp;lt; $EM$&lt;SPAN class=""&gt;4&lt;/SPAN&gt;, &lt;SPAN class=""&gt;52&lt;/SPAN&gt;,
            &lt;SPAN class=""&gt;IF&lt;/SPAN&gt;(&lt;SPAN class=""&gt;EL38&lt;/SPAN&gt; &amp;lt; $EM$&lt;SPAN class=""&gt;4&lt;/SPAN&gt;, &lt;SPAN class=""&gt;26&lt;/SPAN&gt;,
                &lt;SPAN class=""&gt;IF&lt;/SPAN&gt;(&lt;SPAN class=""&gt;ABS&lt;/SPAN&gt;(&lt;SPAN class=""&gt;EF38&lt;/SPAN&gt;) &amp;lt;= $EM$&lt;SPAN class=""&gt;2&lt;/SPAN&gt;, &lt;SPAN class=""&gt;EE38&lt;/SPAN&gt;, &lt;SPAN class=""&gt;MAX&lt;/SPAN&gt;(&lt;SPAN class=""&gt;EE38&lt;/SPAN&gt;, &lt;SPAN class=""&gt;EB38&lt;/SPAN&gt;))
            )
        )
    )
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Extracting the information from the formula:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;List of Table Columns: EB38, EE38, EF38, EG38, EJ38, EK38, EL38&lt;/LI&gt;&lt;LI&gt;List of Parameter Constant: $EM$2, $EM$4&lt;/LI&gt;&lt;LI&gt;Literal constants used 1, 104, 52, 26&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;You can convert to DAX measure :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Method 1: Using IF&amp;nbsp; :&lt;/P&gt;&lt;P&gt;(Note: for example [EG38] will reference the relevant column in your DAX model)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DAXMeasure = 
IF (
    [EG38] = 1,
    IF (
        ABS([EF38]) &amp;lt;= [EM2],
        [EE38],
        MIN(208, MAX([EE38], [EB38]))
    ),
    IF (
        [EJ38] &amp;lt; [EM4], 
        104,
        IF (
            [EK38] &amp;lt; [EM4], 
            52,
            IF (
                [EL38] &amp;lt; [EM4], 
                26,
                IF (
                    ABS([EF38]) &amp;lt;= [EM2], 
                    [EE38], 
                    MAX([EE38], [EB38])
                )
            )
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Method 2: Using Switch&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DAXMeasure = 
SWITCH (
    TRUE(),
    [EG38] = 1 &amp;amp;&amp;amp; ABS([EF38]) &amp;lt;= [EM2], [EE38],
    [EG38] = 1 &amp;amp;&amp;amp; ABS([EF38]) &amp;gt; [EM2], MIN(208, MAX([EE38], [EB38])),
    [EJ38] &amp;lt; [EM4], 104,
    [EK38] &amp;lt; [EM4], 52,
    [EL38] &amp;lt; [EM4], 26,
    ABS([EF38]) &amp;lt;= [EM2], [EE38],
    ABS([EF38]) &amp;gt; [EM2], MAX([EE38], [EB38]),
    BLANK()  -- Default case if none of the conditions are met
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please mark as solution if this meets your requirement.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2024 12:17:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4163903#M165415</guid>
      <dc:creator>Olabanjik</dc:creator>
      <dc:date>2024-09-21T12:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statements in DAX using too many resources</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4164300#M165435</link>
      <description>&lt;P&gt;Thank you for the quick response!&amp;nbsp; I transposed the switch option and still get this msg when I try to apply it to a table visual:&amp;nbsp; Any other suggestions?&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;</description>
      <pubDate>Sat, 21 Sep 2024 20:00:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4164300#M165435</guid>
      <dc:creator>unknown917</dc:creator>
      <dc:date>2024-09-21T20:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statements in DAX using too many resources</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4164331#M165436</link>
      <description>&lt;P&gt;Can you try creating a calculated column to compute this?&lt;/P&gt;&lt;P&gt;I assume the field (&lt;SPAN&gt;EB38, EE38, EF38, EG38, EJ38, EK38, EL38)&amp;nbsp;&lt;/SPAN&gt;are from the same table?&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2024 23:10:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4164331#M165436</guid>
      <dc:creator>Olabanjik</dc:creator>
      <dc:date>2024-09-21T23:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statements in DAX using too many resources</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4164437#M165437</link>
      <description>&lt;P&gt;They are a blend from 2 tables and what if parameters born out of a need for manual intervention&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2024 23:59:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4164437#M165437</guid>
      <dc:creator>unknown917</dc:creator>
      <dc:date>2024-09-21T23:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statements in DAX using too many resources</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4165536#M165487</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="712480" data-lia-user-login="unknown917" class="lia-mention lia-mention-user"&gt;unknown917&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you provide some of the example data? And the output you expect. Please remove any sensitive data in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 01:37:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4165536#M165487</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-23T01:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statements in DAX using too many resources</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4168160#M165596</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="676309" data-lia-user-login="Olabanjik" class="lia-mention lia-mention-user"&gt;Olabanjik&lt;/a&gt;&amp;nbsp;- I converted this to a calculated column and i no longer get the resource error.&amp;nbsp; Thank you!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 18:24:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4168160#M165596</guid>
      <dc:creator>unknown917</dc:creator>
      <dc:date>2024-09-23T18:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statements in DAX using too many resources</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4171645#M165704</link>
      <description>&lt;P&gt;I was actually told in another thread that I should not create a calculated column from measures.&amp;nbsp; Why is this?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 21:04:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4171645#M165704</guid>
      <dc:creator>unknown917</dc:creator>
      <dc:date>2024-09-24T21:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statements in DAX using too many resources</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4179171#M166055</link>
      <description>&lt;P&gt;It depends. A calculated column uses runtime resources -compute power and in-memory space. If this can be optimized as much as possible within resource constraint, why not? The alternative is to rethink your semantic model and streamline your data architecture. Are you using a star-schema or snowflake model? Have you explored merging the two tables into one to reduce your join and moving between tables? All these require looking into your overall design again for opportunities to improve the performance.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 22:12:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Multiple-If-statements-in-DAX-using-too-many-resources/m-p/4179171#M166055</guid>
      <dc:creator>Olabanjik</dc:creator>
      <dc:date>2024-09-26T22:12:22Z</dc:date>
    </item>
  </channel>
</rss>

