Hi eveybody,
I'm trying to transform an excel formula in a power query if statements.
This is the excel formula:
=IF(J2=1;IF(AND(D2=" P";W2="S");ROUND(G2*(1-(N2/10000))-(G2*0,6%);2);IF(AND(D2=" P";W2<>"S");
ROUND($G2*(1-($N2/10000));2);IF($D2=" N";ROUND((G2/(1+(I2/100)))*(1-(N2/10000));2);IF(D2=" D";N2/100))));"")
I've tried to use this in power query:
= if [#" Qty1"]=1 and [#" Dove"]="P" and [Aifa]="S" then Number.Round([#" PrezPub"]*(1-([#" Val1"]/10000))-(([#" PrezPub"]*0.6/100)),2) else if [#" Qty1"]=1 and [#" Dove"]="P" and [Aifa]<>"S" then Number.Round([#" PrezPub"]*(1-([#" Val1"]/10000)),2) else if [#" Qty1"]=1 and [#" Dove"]="N" and [Aifa]<>"S" then Number.Round(([#" PrezPub"]/(1+[#" CodIva"]/100))*(1-([#" Val1"]/10000)),2) else if [#" Qty1"]=1 and [#" Dove"]="D" then [#" PrezPub"]/100 else ""
but I know that it's not possible to use more than one AND condition.
So I tried in this other way but I don't get the same result of the excel formula.
= if [#" Qty1"]=1 then (if [#" Dove"]="P" and [Aifa]="S" then Number.Round([#" PrezPub"]*(1-([#" Val1"]/10000))-(([#" PrezPub"]*0.6/100)),2) else if [#" Dove"]="P" and [Aifa]<>"S" then Number.Round([#" PrezPub"]*(1-([#" Val1"]/10000)),2) else if [#" Dove"]="N" and [Aifa]<>"S" then Number.Round(([#" PrezPub"]/(1+[#" CodIva"]/100))*(1-([#" Val1"]/10000)),2) else if [#" Dove"]="D" then [#" PrezPub"]/100 else "") else ""
I'm going crazy!
Could you help me please?
Thank you
Regards
Marco
I'm trying to transform an excel formula in a power query if statements.
This is the excel formula:
=IF(J2=1;IF(AND(D2=" P";W2="S");ROUND(G2*(1-(N2/10000))-(G2*0,6%);2);IF(AND(D2=" P";W2<>"S");
ROUND($G2*(1-($N2/10000));2);IF($D2=" N";ROUND((G2/(1+(I2/100)))*(1-(N2/10000));2);IF(D2=" D";N2/100))));"")
I've tried to use this in power query:
= if [#" Qty1"]=1 and [#" Dove"]="P" and [Aifa]="S" then Number.Round([#" PrezPub"]*(1-([#" Val1"]/10000))-(([#" PrezPub"]*0.6/100)),2) else if [#" Qty1"]=1 and [#" Dove"]="P" and [Aifa]<>"S" then Number.Round([#" PrezPub"]*(1-([#" Val1"]/10000)),2) else if [#" Qty1"]=1 and [#" Dove"]="N" and [Aifa]<>"S" then Number.Round(([#" PrezPub"]/(1+[#" CodIva"]/100))*(1-([#" Val1"]/10000)),2) else if [#" Qty1"]=1 and [#" Dove"]="D" then [#" PrezPub"]/100 else ""
but I know that it's not possible to use more than one AND condition.
So I tried in this other way but I don't get the same result of the excel formula.
= if [#" Qty1"]=1 then (if [#" Dove"]="P" and [Aifa]="S" then Number.Round([#" PrezPub"]*(1-([#" Val1"]/10000))-(([#" PrezPub"]*0.6/100)),2) else if [#" Dove"]="P" and [Aifa]<>"S" then Number.Round([#" PrezPub"]*(1-([#" Val1"]/10000)),2) else if [#" Dove"]="N" and [Aifa]<>"S" then Number.Round(([#" PrezPub"]/(1+[#" CodIva"]/100))*(1-([#" Val1"]/10000)),2) else if [#" Dove"]="D" then [#" PrezPub"]/100 else "") else ""
I'm going crazy!
Could you help me please?
Thank you
Regards
Marco
Attachments
Last edited: