Forum Discussion

Dave-ExpSC's avatar
Dave-ExpSC
Helper II
6 years ago
Solved

Nested IF Statement too many arguments

Can someone help me with this formula.   In my DATA table I can make this IF statement work: =IF(OR([eSource]="Electricity",[eSource]="Natural Gas"),[Quantity]*0.0036,IF([eSource]="Diesel",[Quanti...
  • Anonymous's avatar
    Anonymous
    6 years ago

    To answer your second question:

     

    Alternatively I tried this formula within Powerpivot that only produces and Error result

    =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,"")))))

     

    You'd be better off storing the multipliers (0.0036, 0.0036, 0.0000049, ...) in your model as an additional column: ENERGYtbl[multiplier].

     

    You then be able to create a calcaulted column 

    [Something] = ENERGYtbl[Quantity] * ENERGYtbl[multiplier]

    which can easily be summed

     

    [Total] = SUM(ENERGYtbl[Something])