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
Sriku
Helper IV
Helper IV

Divide 2 rows in power query

Hi,

How to divide 2 rows in power query if both the columns contains either blank or zero. Here is the sample data I need to divide hrs/Total.

 

HrsTotal
18.0018.00
14.0014.00
4.005.00
5.005.00
20.0020.00
1.001.00
2.002.00
4.004.00
0.00 
3.00 
3.000.00
24.000.00
56.001.00
31.0028.00
8.007.00
  
11.0011.00
12.0012.00
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Sriku ,

 

Try the following code:

 

 try [Hrs]/[Total] otherwise 0

 

If you don't want to have infinity on the calculation do the following

if [Total] = 0 then 0 else try [Hrs]/[Total] otherwise 0

 

On both cases replace the 0 by the value you want if you want to get blank result replace 0 by null

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @Sriku ,

 

Try the following code:

 

 try [Hrs]/[Total] otherwise 0

 

If you don't want to have infinity on the calculation do the following

if [Total] = 0 then 0 else try [Hrs]/[Total] otherwise 0

 

On both cases replace the 0 by the value you want if you want to get blank result replace 0 by null

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.