cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Frequent Visitor

## multiply function IF OR AND

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?

1 ACCEPTED SOLUTION
Community Champion

@BarrbC

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)

5 REPLIES 5
Post Patron

Why not this?

Function Divide

Regards

Anonymous
Not applicable

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?

Frequent Visitor

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

Community Champion

@BarrbC

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)

Post Patron

=IF([Sales]<>0;DIVIDE([Sales]-[Target];[Target]))

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors