<?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: SWITCH with if conditions? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SWITCH-with-if-conditions/m-p/3696922#M143763</link>
    <description>&lt;P&gt;Put a check for if the agent is grandfathered before any of the other logic.&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;SWITCH (
    TRUE (),
    [IsGrandfatheredAgent], .90,
    [TMRA2] &amp;gt;= 0     &amp;amp;&amp;amp; [TMRA2] &amp;lt; 16000, .70,
    [TMRA2] &amp;gt;= 16000 &amp;amp;&amp;amp; [TMRA2] &amp;lt; 36000, .75,
    [TMRA2] &amp;gt;= 36000 &amp;amp;&amp;amp; [TMRA2] &amp;lt; 66000, .80,
    [TMRA2] &amp;gt;= 66000 &amp;amp;&amp;amp; [TMRA2] &amp;lt; 91000, .85,
    .90
)&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 13 Feb 2024 16:39:53 GMT</pubDate>
    <dc:creator>AlexisOlson</dc:creator>
    <dc:date>2024-02-13T16:39:53Z</dc:date>
    <item>
      <title>SWITCH with if conditions?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SWITCH-with-if-conditions/m-p/3696651#M143756</link>
      <description>&lt;P&gt;I have a DAX code in which i'm creating % buckets based on ranges of values...the below is creating a bucket based on where each agent falls according to amount of sales:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Value = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SWITCH&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DI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/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;.80&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[TMRA2]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;= &lt;/SPAN&gt;&lt;SPAN&gt;66000&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;[TMRA2]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;91000&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;.85&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.90&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;This works, however one agent is 'grandfathered' and has a default percentage of 90% regardless of sales.&amp;nbsp; &amp;nbsp;I would love to keep them all in one visual instead of creating a seperate bucket that just equals 90%.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Is there any way to do this?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 13 Feb 2024 14:47:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SWITCH-with-if-conditions/m-p/3696651#M143756</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-13T14:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: SWITCH with if conditions?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SWITCH-with-if-conditions/m-p/3696922#M143763</link>
      <description>&lt;P&gt;Put a check for if the agent is grandfathered before any of the other logic.&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;SWITCH (
    TRUE (),
    [IsGrandfatheredAgent], .90,
    [TMRA2] &amp;gt;= 0     &amp;amp;&amp;amp; [TMRA2] &amp;lt; 16000, .70,
    [TMRA2] &amp;gt;= 16000 &amp;amp;&amp;amp; [TMRA2] &amp;lt; 36000, .75,
    [TMRA2] &amp;gt;= 36000 &amp;amp;&amp;amp; [TMRA2] &amp;lt; 66000, .80,
    [TMRA2] &amp;gt;= 66000 &amp;amp;&amp;amp; [TMRA2] &amp;lt; 91000, .85,
    .90
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Feb 2024 16:39:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SWITCH-with-if-conditions/m-p/3696922#M143763</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-02-13T16:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: SWITCH with if conditions?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SWITCH-with-if-conditions/m-p/3696984#M143765</link>
      <description>&lt;P&gt;Thanks, I can't get that to work though.&amp;nbsp; I created a column to indicate whether or not agent was grandfathered, but i'm not able to add that to the SWITCH formula&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 17:10:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SWITCH-with-if-conditions/m-p/3696984#M143765</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-13T17:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: SWITCH with if conditions?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SWITCH-with-if-conditions/m-p/3697086#M143770</link>
      <description>&lt;P&gt;If you're writing a measure rather than a calculated column, then you can't just use the column, you need some sort of aggregator. For example, assuming you have a 0/1 column in your agent dimension table,&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;SWITCH (
    TRUE (),
    SELECTEDVALUE ( dimAgent[IsGrandfathered] ) = 1, .90,
    [TMRA2] &amp;gt;= 0     &amp;amp;&amp;amp; [TMRA2] &amp;lt; 16000, .70,
    [TMRA2] &amp;gt;= 16000 &amp;amp;&amp;amp; [TMRA2] &amp;lt; 36000, .75,
    [TMRA2] &amp;gt;= 36000 &amp;amp;&amp;amp; [TMRA2] &amp;lt; 66000, .80,
    [TMRA2] &amp;gt;= 66000 &amp;amp;&amp;amp; [TMRA2] &amp;lt; 91000, .85,
    .90
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Feb 2024 18:19:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SWITCH-with-if-conditions/m-p/3697086#M143770</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-02-13T18:19:43Z</dc:date>
    </item>
  </channel>
</rss>

