<?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: Nested if statements/Switch function? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2268173#M55097</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240201" data-lia-user-login="Lexi" class="lia-mention lia-mention-user"&gt;Lexi&lt;/a&gt;&amp;nbsp; did you try this out yet?&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jan 2022 21:21:36 GMT</pubDate>
    <dc:creator>smpa01</dc:creator>
    <dc:date>2022-01-05T21:21:36Z</dc:date>
    <item>
      <title>Nested if statements/Switch function?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2261282#M54689</link>
      <description>&lt;P&gt;Howdy!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need some direction from you nice guys&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to Powerbi and I am trying to get to a solution to my issue. I have a dataset and I am assigning groups to our customers&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-center"&gt;Customer 1001 = US Postal Code&lt;/P&gt;&lt;P class="lia-align-center"&gt;Customer 1002 = Europe Postal Code&lt;/P&gt;&lt;P class="lia-align-center"&gt;Customer 1003 = Asia Postal Code.&lt;/P&gt;&lt;P&gt;An issue appears when the customer moves or if they order for another customer. So I want to build in a function or create a custom column (that can be used in a filter). I am using the switch function for the normal customers but I need away to include the abnormal cases.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 15:05:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2261282#M54689</guid>
      <dc:creator>Lexi</dc:creator>
      <dc:date>2021-12-30T15:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if statements/Switch function?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2261456#M54702</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Unfortunately, your post is rather difficuilt to understand and it would be good if you provided more information. For now, the only help that I can give is to show some patterns/tips that I use in my models when I want to categorise customers in measures:&lt;BR /&gt;&lt;BR /&gt;First typically I create a SWITCH + TRUE structure where it goes something like this:&lt;BR /&gt;&lt;BR /&gt;SWITCH(TRUE(),&lt;BR /&gt;PLACE IF CONDITION HERE, "Category 1",&lt;BR /&gt;PLACE IF CONDITION HERE, "Category 2",&lt;BR /&gt;PLACE IF CONDITION HERE, "Category 2")&lt;BR /&gt;&lt;BR /&gt;Then I create a table which has these states to use as a filter:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Table = {("Category 1"),("Category 2"),("Category 3")}&lt;BR /&gt;&lt;BR /&gt;Finally I create a filter measure to use in my visuals:&lt;BR /&gt;Customer category switch filter:= IF(&lt;BR /&gt;or(not(HASONEFILTER('Table'[Value])),[Customer category]=max('Table'[Value])),1,0)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I hope this helps to solve your issue and if it does consider accepting this as a solution and giving the post a thumbs up!&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 17:57:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2261456#M54702</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-30T17:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if statements/Switch function?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2261478#M54704</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240201" data-lia-user-login="Lexi" class="lia-mention lia-mention-user"&gt;Lexi&lt;/a&gt;&amp;nbsp; need more info, provide sample data and expected output.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 18:20:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2261478#M54704</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2021-12-30T18:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if statements/Switch function?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2266022#M54916</link>
      <description>&lt;P&gt;Thanks folks!&lt;BR /&gt;&lt;BR /&gt;I am trying to get at column D so I can use it later on as a filter in the main dashboard.&lt;BR /&gt;&lt;BR /&gt;So I created this formal so far -&lt;BR /&gt;&lt;BR /&gt;POSTAL CODE = Switch([CustomerID],&lt;BR /&gt;"Customer1001", "USA",&lt;BR /&gt;"Customer 1002", "EU", "Other"&lt;BR /&gt;&lt;BR /&gt;This works for the customers that have no difference. I need to complete the column of the customers that dont conform. I want to try to complete a column with those easy customers that follow correctly and then the ones that dont, but I am unsure how to add the exceptions.&lt;BR /&gt;&lt;BR /&gt;Ie: Customer 1001 if shipping address is europe then the postal code is eu otherwise usa&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>Tue, 04 Jan 2022 18:27:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2266022#M54916</guid>
      <dc:creator>Lexi</dc:creator>
      <dc:date>2022-01-04T18:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if statements/Switch function?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2266052#M54918</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240201" data-lia-user-login="Lexi" class="lia-mention lia-mention-user"&gt;Lexi&lt;/a&gt;&amp;nbsp; can you try this&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column =
VAR _home =
    SELECTCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[CustID] ) ),
            'Table'[CustID],
            'Table'[Home]
        ),
        "cust", [CustID],
        "country", [Home]
    )
VAR _shipping =
    SELECTCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[CustID] ) ),
            'Table'[CustID],
            'Table'[Shipping]
        ),
        "cust", [CustID],
        "country", [Shipping]
    )
VAR _intersect =
    INTERSECT ( _home, _shipping )
VAR _except =
    EXCEPT ( _shipping, _home )
RETURN
    IF (
        MAXX ( _except, [country] ) = BLANK (),
        MAXX ( _intersect, [country] ),
        MAXX ( _except, [country] )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which generates this&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 18:50:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2266052#M54918</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2022-01-04T18:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if statements/Switch function?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2268173#M55097</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240201" data-lia-user-login="Lexi" class="lia-mention lia-mention-user"&gt;Lexi&lt;/a&gt;&amp;nbsp; did you try this out yet?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 21:21:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2268173#M55097</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2022-01-05T21:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if statements/Switch function?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2272453#M55368</link>
      <description>&lt;P&gt;Hi Smpa01, thanks you sir for helping me out!!!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I tried out your formual but it aint working for me as I figured out my conditions are more complicated than I first intended.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":crying_face:"&gt;😢&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have one set of customers (150 in total) following one swich formual correct (VAR a), then about 5 customers that are the outliers and do not follow suit. I meantion two hard ones below (Var B, Var C)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Var a = switch ([customer],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"Customer 1001" , "USA",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Customer 1002", "Asia", "Other&amp;nbsp; ...... and so on&lt;BR /&gt;Var b = if [Customer] = "2002" &amp;amp;&amp;amp; [cat] &amp;lt;&amp;gt; "Household" THEN " USA" else "Europe"&lt;BR /&gt;Var c = if&amp;nbsp;[Customer] = "2002" &amp;amp;&amp;amp; [order date] &amp;gt; "2021, 10, 1" then "USA" else "Asia"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How the do I even try get this into a new custom column? Any direction will help!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":crossed_fingers:"&gt;🤞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 20:24:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2272453#M55368</guid>
      <dc:creator>Lexi</dc:creator>
      <dc:date>2022-01-07T20:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if statements/Switch function?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2276023#M55560</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for all your contribution.&lt;BR /&gt;&lt;BR /&gt;I tried out your formual but it aint working for me as I figured out my conditions are more complicated than I first intended.&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;I have one set of customers (150 in total) following one swich formual correct (VAR a), then about 5 customers that are the outliers and do not follow suit. I meantion two hard ones below (Var B, Var C)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Var a = switch ([customer],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"Customer 1001" , "USA",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Customer 1002", "Asia", "Other&amp;nbsp; ...... and so on&lt;BR /&gt;Var b = if [Customer] = "2002" &amp;amp;&amp;amp; [cat] &amp;lt;&amp;gt; "Household" THEN " USA" else "Europe"&lt;BR /&gt;Var c = if&amp;nbsp;[Customer] = "2002" &amp;amp;&amp;amp; [order date] &amp;gt; "2021, 10, 1" then "USA" else "Asia"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How the do I even try get this into a new custom column? Any direction will help!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 18:16:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2276023#M55560</guid>
      <dc:creator>Lexi</dc:creator>
      <dc:date>2022-01-10T18:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if statements/Switch function?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2276032#M55561</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240201" data-lia-user-login="Lexi" class="lia-mention lia-mention-user"&gt;Lexi&lt;/a&gt;&amp;nbsp; can you please create a new thread with sample data, expected output?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 18:18:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-if-statements-Switch-function/m-p/2276032#M55561</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2022-01-10T18:18:53Z</dc:date>
    </item>
  </channel>
</rss>

