<?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 IF function Need Help in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987472#M100331</link>
    <description>&lt;P&gt;I've been having this issue for days already and i hope someone can help me with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;= Table.AddColumn(#"Removed Columns", "Custom", each if[order_estimated_delivery_date] &amp;gt;0 then "Early Delivery" else "null"&lt;BR /&gt;(if[order_estimated_delivery_date] =0 then "On Time" else "null"&lt;BR /&gt;(if[order_estimated_delivery_date] &amp;lt;=0 then "Late Delivery" else "null")))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the problem that im having is that instead of having 3 results is im only having 1. I tried also with " cunditional column" but the same results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need help for this.&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 24 Dec 2022 07:26:31 GMT</pubDate>
    <dc:creator>Nathanael04</dc:creator>
    <dc:date>2022-12-24T07:26:31Z</dc:date>
    <item>
      <title>IF function Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987472#M100331</link>
      <description>&lt;P&gt;I've been having this issue for days already and i hope someone can help me with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;= Table.AddColumn(#"Removed Columns", "Custom", each if[order_estimated_delivery_date] &amp;gt;0 then "Early Delivery" else "null"&lt;BR /&gt;(if[order_estimated_delivery_date] =0 then "On Time" else "null"&lt;BR /&gt;(if[order_estimated_delivery_date] &amp;lt;=0 then "Late Delivery" else "null")))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the problem that im having is that instead of having 3 results is im only having 1. I tried also with " cunditional column" but the same results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need help for this.&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Dec 2022 07:26:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987472#M100331</guid>
      <dc:creator>Nathanael04</dc:creator>
      <dc:date>2022-12-24T07:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: IF function Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987479#M100332</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="490890" data-lia-user-login="Nathanael04" class="lia-mention lia-mention-user"&gt;Nathanael04&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;= Table.AddColumn(#"Removed Columns", "Custom", each
      if [order_estimated_delivery_date] &amp;gt;0 then "Early Delivery" else
        if [order_estimated_delivery_date] =0 then "On Time" else
          if [order_estimated_delivery_date] &amp;lt;=0 then "Late Delivery" else null ) &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Dec 2022 07:59:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987479#M100332</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2022-12-24T07:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: IF function Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987487#M100333</link>
      <description>&lt;P&gt;Expression.Error: 2 arguments were passed to a function which expects between 3 and 4.&lt;BR /&gt;Details:&lt;BR /&gt;Pattern=&lt;BR /&gt;Arguments=[List]&lt;/P&gt;</description>
      <pubDate>Sat, 24 Dec 2022 08:28:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987487#M100333</guid>
      <dc:creator>Nathanael04</dc:creator>
      <dc:date>2022-12-24T08:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: IF function Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987490#M100334</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="490890" data-lia-user-login="Nathanael04" class="lia-mention lia-mention-user"&gt;Nathanael04&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code is correct.&amp;nbsp; The function Table.AddColum is being passed 3 arguments so perhaps you have not copied it in full or the error is coming from somewhere else. If you can share the query I can have a look&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Dec 2022 08:43:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987490#M100334</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2022-12-24T08:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: IF function Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987502#M100343</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="490890" data-lia-user-login="Nathanael04" class="lia-mention lia-mention-user"&gt;Nathanael04&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See attached file. It's the same code as earlier. Do note that the [order_estimated_delivery_date] column in the data you have shared is of type date but it is an integer in the data you showed on your initial post. Integer is what makes sense here so I have replaced the dates with some random numbers in the data for the example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Dec 2022 10:04:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987502#M100343</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2022-12-24T10:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: IF function Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987511#M100346</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="490890" data-lia-user-login="Nathanael04" class="lia-mention lia-mention-user"&gt;Nathanael04&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the code below&amp;nbsp; and the file attached for a more elaborate solution where we first calculate the difference in days between the estimated and the actual delivery date. Note that the relevant steps in the M code below start at&amp;nbsp;#"Added Custom1"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZZNNrtswDISvEmT9gJAUKZK6SvAWEiUBBbrqouev/NMmcQEv7A+iNZoZPZ/3wYZTMFoP4azWNIIdU57Uc516/7r7mJxotEyC5JqAh2a03BCqk/W1pI+fP36PX2N7R3gAPVBvCEXyB8ACegLegReRA2yP3ggL/QW2AYACcP/+et4lRW80w1pojwEtK+MgFCBNLLimGliC2VhZa47cCfqo0CwMqOuYF6GgD1oy7EZQGE+QNwCpEL8D5JL2FUtU2oEU0nfwEsqqCqM5AgR1CGbn3D0m6Igs286MMagKBzRIbSbmFKl7wpqygvlVqD22fdYmVpJdwG7gP4CpCJy6dAdWYAsBfPf8Xaizd2nMvU3pw9Hm8MA8XRvLtLqmphm6cpZR1QlqXxmM0KSSMneja/R4xraCJbsAlgPQ0YVU0nZOpBMsXcfI+pLP6GsnDPEAYxg5mqXqMZqIpmko22+sNldfzcy9jmqWc2+9Bc+mdY3H1VE6Y1uFQ/sAVAhOsPu1Kc8nyKejqAc42/ISyuIYtOxCi4arpkPIzAd1qxFpTQkkXafwqLpuXfRetVWy4bXZzGD/d3Qld9wM0Q9ABeEAm8u6dVTsVdrj/p0dBXxz9PsP", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [order_id = _t, customer_id = _t, order_status = _t, order_purchase_timestamp = _t, order_approved_at = _t, order_delivered_carrier_date = _t, order_delivered_customer_date = _t, order_estimated_delivery_date = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"order_id", type text}, {"customer_id", type text}, {"order_status", type text}, {"order_purchase_timestamp", type datetime}, {"order_approved_at", type datetime}, {"order_delivered_carrier_date", type datetime}, {"order_delivered_customer_date", type datetime}, {"order_estimated_delivery_date", type datetime}}),


    #"Added Custom1" = Table.AddColumn(#"Changed Type", "Days_Diff", each Duration.Days([order_estimated_delivery_date]-[order_delivered_customer_date])),
    #"Added Custom" = Table.AddColumn(#"Added Custom1", "Custom", each if [Days_Diff] &amp;gt;0 then "Early Delivery" else if [Days_Diff] =0 then "On Time" else if [Days_Diff] &amp;lt;0 then "Late Delivery" else null, type text)
in
    #"Added Custom"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Dec 2022 10:41:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/IF-function-Need-Help/m-p/2987511#M100346</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2022-12-24T10:41:25Z</dc:date>
    </item>
  </channel>
</rss>

