<?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 Conditional DAX equivalent of M? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262164#M21035</link>
    <description>&lt;P&gt;Hello I am trying to get the equivalent of the following M code in DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;M:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if Text.Contains(Text.Lower([prod_name]),"purple") then "purple" else if Text.Contains(Text.Lower([prod_name]),"black") then "black" else if Text.Contains(Text.Lower([prod_name]),"white") then "white" else if Text.Contains(Text.Lower([prod_name]),"green") then "green"
else if Text.Contains(Text.Lower([prod_name]),"yellow") then "green" else if Text.Contains(Text.Lower([prod_name]),"blue") then "Blue" else if Text.Contains(Text.Lower([prod_name]),"red") then "Red" else Null.Type&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this in DAX but it only prints the final condition&lt;/P&gt;&lt;P&gt;DAX:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Flavors = if(CONTAINS(table,table[prod_name],"purple"),"purple",IF(CONTAINS(table,table[prod_name],"black"),"black",IF(CONTAINS(table,table[prod_name],"white"),"white",if(CONTAINS(table,table[prod_name],"yellow",table[prod_name],"green"),"green",if(CONTAINS(table,v[prod_name],"red"),"Red","Blue")))))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea how I could do this? Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jul 2020 12:46:36 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-07-30T12:46:36Z</dc:date>
    <item>
      <title>Conditional DAX equivalent of M?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262164#M21035</link>
      <description>&lt;P&gt;Hello I am trying to get the equivalent of the following M code in DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;M:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if Text.Contains(Text.Lower([prod_name]),"purple") then "purple" else if Text.Contains(Text.Lower([prod_name]),"black") then "black" else if Text.Contains(Text.Lower([prod_name]),"white") then "white" else if Text.Contains(Text.Lower([prod_name]),"green") then "green"
else if Text.Contains(Text.Lower([prod_name]),"yellow") then "green" else if Text.Contains(Text.Lower([prod_name]),"blue") then "Blue" else if Text.Contains(Text.Lower([prod_name]),"red") then "Red" else Null.Type&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this in DAX but it only prints the final condition&lt;/P&gt;&lt;P&gt;DAX:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Flavors = if(CONTAINS(table,table[prod_name],"purple"),"purple",IF(CONTAINS(table,table[prod_name],"black"),"black",IF(CONTAINS(table,table[prod_name],"white"),"white",if(CONTAINS(table,table[prod_name],"yellow",table[prod_name],"green"),"green",if(CONTAINS(table,v[prod_name],"red"),"Red","Blue")))))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea how I could do this? Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 12:46:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262164#M21035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-30T12:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional DAX equivalent of M?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262190#M21036</link>
      <description>&lt;P&gt;Try the switch function&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://docs.microsoft.com/en-us/dax/switch-function-dax" target="_blank" rel="noopener"&gt;https://docs.microsoft.com/en-us/dax/switch-function-dax&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Something along the lines of&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Column = SWITCH([prod_name], 
"purple", "purple",
"black", "black",
"white", "white",
"green", "green",
"yellow", "green",
"blue", "Blue",
"red", "Red",
"null")&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:22:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262190#M21036</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-30T13:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional DAX equivalent of M?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262217#M21038</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&amp;nbsp;Does the value have to be a number, because this is only returning the "else" condition&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:12:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262217#M21038</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-30T13:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional DAX equivalent of M?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262248#M21039</link>
      <description>&lt;P&gt;should work&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Column = SWITCH([prod_name], 
"purple", "purple",
"black", "black",
"white", "white",
"green", "green",
"yellow", "green",
"blue", "Blue",
"red", "Red",
"null")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:23:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262248#M21039</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-30T13:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional DAX equivalent of M?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262250#M21040</link>
      <description>&lt;P&gt;It's important to note, that it's ALL case sensitive + it'll include any trailing or leading spaces. for example&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"black" is NOT equal to "Black" or "black " or " black" etc..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:24:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262250#M21040</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-30T13:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional DAX equivalent of M?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262252#M21041</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&amp;nbsp;Oh ok, I think this doesn't work in my case becuase there are multiple details in the [prod_name] column, so instead of purple it will say "purple(S)" or "purple[M]". Is there a way to integrate CONTAINS?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:26:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262252#M21041</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-30T13:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional DAX equivalent of M?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262283#M21045</link>
      <description>&lt;P&gt;This worked&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Flavors = SWITCH(
    TRUE(),
    ISERROR( FIND("purple", table[prod_name]))&amp;lt;&amp;gt; TRUE(), "purple",
    ISERROR( FIND("white", table[prod_name]))&amp;lt;&amp;gt; TRUE(), "white",
    ISERROR( FIND("black", table[prod_name]))&amp;lt;&amp;gt; TRUE(), "black",
    ISERROR( FIND("yellow", table[prod_name]))&amp;lt;&amp;gt; TRUE(), "green",
    ISERROR( FIND("green", table[prod_name]))&amp;lt;&amp;gt; TRUE(), "green",
    ISERROR( FIND("blue", table[prod_name]))&amp;lt;&amp;gt; TRUE(), "Blue",
    ISERROR( FIND("red", table[prod_name]))&amp;lt;&amp;gt; TRUE(), "Red",""
)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:45:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262283#M21045</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-30T13:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional DAX equivalent of M?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262306#M21046</link>
      <description>&lt;P&gt;The following would have also worked.&amp;nbsp;&lt;BR /&gt;Please ensure you accept a solution to close the topic.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Column 2 =
IF (
    CONTAINSSTRING ( 'Table (2)'[prod_name], "purple" ),
    "purple",
    IF (
        CONTAINSSTRING ( 'Table (2)'[prod_name], "black" ),
        "black",
        IF (
            CONTAINSSTRING ( 'Table (2)'[prod_name], "white" ),
            "white",
            IF (
                CONTAINSSTRING ( 'Table (2)'[prod_name], "green" ),
                "green",
                IF (
                    CONTAINSSTRING ( 'Table (2)'[prod_name], "yellow" ),
                    "green",
                    IF (
                        CONTAINSSTRING ( 'Table (2)'[prod_name], "blue" ),
                        "Blue",
                        IF ( CONTAINSSTRING ( 'Table (2)'[prod_name], "red" ), "Red", "null" )
                    )
                )
            )
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:53:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-DAX-equivalent-of-M/m-p/1262306#M21046</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-30T13:53:00Z</dc:date>
    </item>
  </channel>
</rss>

