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.
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.
Hrs | Total |
18.00 | 18.00 |
14.00 | 14.00 |
4.00 | 5.00 |
5.00 | 5.00 |
20.00 | 20.00 |
1.00 | 1.00 |
2.00 | 2.00 |
4.00 | 4.00 |
0.00 | |
3.00 | |
3.00 | 0.00 |
24.00 | 0.00 |
56.00 | 1.00 |
31.00 | 28.00 |
8.00 | 7.00 |
11.00 | 11.00 |
12.00 | 12.00 |
Solved! Go to Solution.
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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCovering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
96 | |
77 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |