<?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 Nested IF Statement too many arguments in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-Statement-too-many-arguments/m-p/790790#M4512</link>
    <description>&lt;P&gt;Can someone help me with this formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my DATA table&amp;nbsp;I can make this IF statement work:&lt;/P&gt;&lt;P&gt;=IF(OR([eSource]="Electricity",[eSource]="Natural Gas"),[Quantity]*0.0036,IF([eSource]="Diesel",[Quantity]*0.0364,""))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However if I take it one step further it fails:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;=IF(OR([eSource]="Electricity",[eSource]="Natural Gas"),[Quantity]*0.0036,&lt;/FONT&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;IF([eSource]="Diesel",[Quantity]*0.0364&lt;/FONT&gt;,IF([eSource]="LPG"),[Quantity]*.0000049&lt;/FONT&gt;,""))&lt;/P&gt;&lt;P&gt;Formula check highlights "LPG"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How can I use the IF statement to allow more than 3 criteria&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Alternatively I tried this formula within Powerpivot that only produces and Error result&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;=SUMX(ENERGYtbl,IF(ENERGYtbl[eSource]="Natural Gas",ENERGYtbl[Quantity]*.0036,IF(ENERGYtbl[eSource]="Electricity",ENERGYtbl[Quantity]*.0036,IF(ENERGYtbl[eSource]="LPG",ENERGYtbl[Quantity]*.0000049,IF(ENERGYtbl[eSource]="Diesel",ENERGYtbl[Quantity]*.0364,"")))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to have a formula that allows me to keep adding to the formula as new energy sources get added to the project.&lt;/P&gt;&lt;P&gt;Help is much appreciated!&lt;/P&gt;</description>
    <pubDate>Thu, 12 Sep 2019 14:59:32 GMT</pubDate>
    <dc:creator>Dave-ExpSC</dc:creator>
    <dc:date>2019-09-12T14:59:32Z</dc:date>
    <item>
      <title>Nested IF Statement too many arguments</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-Statement-too-many-arguments/m-p/790790#M4512</link>
      <description>&lt;P&gt;Can someone help me with this formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my DATA table&amp;nbsp;I can make this IF statement work:&lt;/P&gt;&lt;P&gt;=IF(OR([eSource]="Electricity",[eSource]="Natural Gas"),[Quantity]*0.0036,IF([eSource]="Diesel",[Quantity]*0.0364,""))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However if I take it one step further it fails:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;=IF(OR([eSource]="Electricity",[eSource]="Natural Gas"),[Quantity]*0.0036,&lt;/FONT&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;IF([eSource]="Diesel",[Quantity]*0.0364&lt;/FONT&gt;,IF([eSource]="LPG"),[Quantity]*.0000049&lt;/FONT&gt;,""))&lt;/P&gt;&lt;P&gt;Formula check highlights "LPG"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How can I use the IF statement to allow more than 3 criteria&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Alternatively I tried this formula within Powerpivot that only produces and Error result&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;=SUMX(ENERGYtbl,IF(ENERGYtbl[eSource]="Natural Gas",ENERGYtbl[Quantity]*.0036,IF(ENERGYtbl[eSource]="Electricity",ENERGYtbl[Quantity]*.0036,IF(ENERGYtbl[eSource]="LPG",ENERGYtbl[Quantity]*.0000049,IF(ENERGYtbl[eSource]="Diesel",ENERGYtbl[Quantity]*.0364,"")))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to have a formula that allows me to keep adding to the formula as new energy sources get added to the project.&lt;/P&gt;&lt;P&gt;Help is much appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 14:59:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-Statement-too-many-arguments/m-p/790790#M4512</guid>
      <dc:creator>Dave-ExpSC</dc:creator>
      <dc:date>2019-09-12T14:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Nested IF Statement too many arguments</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-Statement-too-many-arguments/m-p/790797#M4513</link>
      <description>&lt;P&gt;&lt;FONT color="#000000"&gt;Looks like you have an extra closing brace&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;=IF(OR([eSource]="Electricity",[eSource]="Natural Gas"),[Quantity]*0.0036,&lt;/FONT&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;IF([eSource]="Diesel",[Quantity]*0.0364&lt;/FONT&gt;,IF([eSource]="LPG"&lt;FONT size="6"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;,[Quantity]*.0000049&lt;/FONT&gt;&lt;SPAN&gt;,""))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Edit: and possibly missing a closing one at the end.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 15:06:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-Statement-too-many-arguments/m-p/790797#M4513</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-12T15:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Nested IF Statement too many arguments</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-Statement-too-many-arguments/m-p/790820#M4514</link>
      <description>&lt;P&gt;To answer your second question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Alternatively I tried this formula within Powerpivot that only produces and Error result&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;=SUMX(ENERGYtbl,IF(ENERGYtbl[eSource]="Natural Gas",ENERGYtbl[Quantity]*.0036,IF(ENERGYtbl[eSource]="Electricity",ENERGYtbl[Quantity]*.0036,IF(ENERGYtbl[eSource]="LPG",ENERGYtbl[Quantity]*.0000049,IF(ENERGYtbl[eSource]="Diesel",ENERGYtbl[Quantity]*.0364,"")))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You'd be better off storing the multipliers (0.0036, 0.0036, 0.0000049, ...) in your model as an additional column:&amp;nbsp;ENERGYtbl[multiplier].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You then be able to create a calcaulted column&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[Something] =&amp;nbsp;ENERGYtbl[Quantity] *&amp;nbsp;ENERGYtbl[multiplier]&lt;/PRE&gt;&lt;P&gt;which can easily be summed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[Total] = SUM(ENERGYtbl[Something])&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Sep 2019 15:24:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-Statement-too-many-arguments/m-p/790820#M4514</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-12T15:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Nested IF Statement too many arguments</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-Statement-too-many-arguments/m-p/790833#M4515</link>
      <description>&lt;P&gt;Thank you very much that's a good idea.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 15:40:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-IF-Statement-too-many-arguments/m-p/790833#M4515</guid>
      <dc:creator>Dave-ExpSC</dc:creator>
      <dc:date>2019-09-12T15:40:47Z</dc:date>
    </item>
  </channel>
</rss>

