cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rsanjuan
Helper IV
Helper IV

IF - THEN Calculation

I have two columns....Proposed Budget and Proposed Costs.  I am trying to calculate the gross margin % using this formula:

 

(Proposed Budget - Proposed Costs) / Proposed Budget

 

However, there are rows where Proposed Budget and Proposed Costs have values of 0.  And when 0 is divided by 0, I am getting a NaN error.

 

What would be the correct syntax to only calculate this formula ONLY when Proposed Budget > 0?

 

Thanks!

 

2 ACCEPTED SOLUTIONS
Vvelarde
Community Champion
Community Champion

@Rsanjuan

 

hi, try using Divide Function

 

Result=Divide(Table1[Proposed Budget]- Table1[Proposed Costs], Table1[Proposed Budget],Blank())




Lima - Peru

View solution in original post

geeb
Regular Visitor

You can also use IF([Proposed Budget] > 0, ([Proposed Budget] -[Proposed Costs]) / [Proposed Budget]). This will return a blank if the condition is false.

 

The solution above is nice and clean though.

View solution in original post

2 REPLIES 2
geeb
Regular Visitor

You can also use IF([Proposed Budget] > 0, ([Proposed Budget] -[Proposed Costs]) / [Proposed Budget]). This will return a blank if the condition is false.

 

The solution above is nice and clean though.

View solution in original post

Vvelarde
Community Champion
Community Champion

@Rsanjuan

 

hi, try using Divide Function

 

Result=Divide(Table1[Proposed Budget]- Table1[Proposed Costs], Table1[Proposed Budget],Blank())




Lima - Peru

View solution in original post

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.