The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
what should be the proper formula if you have to calculate (A-B)B, if there a options that A and B are zeros, or only B is zero.
column = if(and('A=0,B=0), 0, (IF('B=0), 0, A/'B])
Would it be correct?
thanks in advance
Solved! Go to Solution.
Why dont you keep the formula as is (A-B)/B and if it gives you an error then convert the error to zero.
Simpler formula i think.
IFERROR( ([Sales]-[Target] / [Target]), 0)
SWITCH(TRUE(),[a]=0,0,[b]=0,0,[a]/[b])
This will only divide A by B if both aren't equal to 0, did I understand you correctly?
hi Tom,
actually the A -is the sales, and B - is the target sales, so it can be that that there's no sales which means no target
Why dont you keep the formula as is (A-B)/B and if it gives you an error then convert the error to zero.
Simpler formula i think.
IFERROR( ([Sales]-[Target] / [Target]), 0)
How about:
=IF([Sales]<>0;DIVIDE([Sales]-[Target];[Target]))