Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BarrbC
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?

 

thanks in advance

 

1 ACCEPTED SOLUTION

@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)

View solution in original post

5 REPLIES 5
Fcoatis
Post Patron
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?

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 

@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)

How about:

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.