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

Divida 2 filas en la consulta de energía

Hola

Cómo dividir 2 filas en la consulta de energía si ambas columnas contienen en blanco o cero. Aquí están los datos de muestra que necesito para dividir hrs/Total.

HorasTotal
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

Hola @Sriku ,

Pruebe el siguiente código:

 try [Hrs]/[Total] otherwise 0

Si no desea tener infinito en el cálculo, haga lo siguiente

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

En ambos casos reemplace el 0 por el valor que desea si desea obtener el resultado en blanco reemplace 0 por 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

Hola @Sriku ,

Pruebe el siguiente código:

 try [Hrs]/[Total] otherwise 0

Si no desea tener infinito en el cálculo, haga lo siguiente

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

En ambos casos reemplace el 0 por el valor que desea si desea obtener el resultado en blanco reemplace 0 por 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.