Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

DAX function POWER() has a bug

POWER ( 0, 0 ) results in an error. The result should be 1. Same goes for 0^0.

test.png

 

 

Status: Delivered

Hi  @Anonymous 

Mathematically speaking, 0 to the 0th power has no meaning, so there is no such thing as a bug. The number inside the function can be any number, but not 2 zeros.

vyetao1msft_0-1692952344417.png

vyetao1msft_1-1692952377702.png

vyetao1msft_2-1692952410868.png

Best Regards,
Community Support Team _ Ailsa Tao

 

Comments
v-yetao1-msft
Community Support
Status changed to: Delivered

Hi  @Anonymous 

Mathematically speaking, 0 to the 0th power has no meaning, so there is no such thing as a bug. The number inside the function can be any number, but not 2 zeros.

vyetao1msft_0-1692952344417.png

vyetao1msft_1-1692952377702.png

vyetao1msft_2-1692952410868.png

Best Regards,
Community Support Team _ Ailsa Tao

 

Anonymous
Not applicable

But mathematically speaking, 0 to the power of 0 must be 1.

 

I provided no context on this one, but I discovered the bug because I was using the POWER() function to get better performance on a rather complex calculation group. Thus, I was trying to transform all my simple IF() statements into POWER() to make the code run faster.

 

An example:
Instead of

VAR totalSum = SUM ( [Column] )
RETURN IF ( totalSum > 1000, DIVIDE ( totalSum ), 1000 ), totalSum )

I wanted to use

VAR totalSum = SUM ( [Column] )
RETURN DIVIDE ( totalSum, POWER ( 1000, INT ( totalSum > 1000 ) )

That way, when totalSum > 1000, POWER() returns 1000, else it returns 1.

 

Of course, the problem is that if you use this in any visual that has a zero in the row context, you run into the case of POWER ( 0, 0 ), hence getting the error mentioned above.