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
juhayes
New Member

New to Power BI

Quick Question,

 

I'm currently conducting a Profit Margin calculation where our company has costs associated with no sales on the same day. Thus, our Profit turns into a negative number for that day. I'm attempting to calculate the Profit Margin for that day but am getting an "-Infinity" result, I'm guessing from a 'divide by zero' error. Here is my formula, very simple:

 

ProfitMargin = Test_Sales[Profit]/Test_Sales[Revenue]

 

I've changed the formatting to percentage in BI Modeling etc. Just not sure where to go from here.

 

 

2 ACCEPTED SOLUTIONS
chrisu
Responsive Resident
Responsive Resident

This seems like a good scenario for DIVIDE, which lets you account for divide by zero errors..  Like this:

 

ProfitMargin = DIVIDE(Test_Sales[Profit,Test_Sales[Revenue],0)

 

See: https://msdn.microsoft.com/en-us/library/jj677276.aspx

View solution in original post

v-ljerr-msft
Employee
Employee

Hi @juhayes,

 

As chrisu have mentioned above, you should use DIVIDE Function (DAX) to perform the division in this scenario.Smiley Happy

 

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Employee
Employee

Hi @juhayes,

 

As chrisu have mentioned above, you should use DIVIDE Function (DAX) to perform the division in this scenario.Smiley Happy

 

Regards

chrisu
Responsive Resident
Responsive Resident

This seems like a good scenario for DIVIDE, which lets you account for divide by zero errors..  Like this:

 

ProfitMargin = DIVIDE(Test_Sales[Profit,Test_Sales[Revenue],0)

 

See: https://msdn.microsoft.com/en-us/library/jj677276.aspx

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.

Top Solution Authors
Top Kudoed Authors