Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to use Power() and Exp() correctly in power bi

I have a simple function that is returning two different values in SQL and PowerBI.

Here is the equation:

1 - power(0.9240, exp((-0.2201*((71/10)-7.036))+(0.2467*(0-0.5642))-(0.5567*((60/5)-7.222))+(0.4510*(log(13.5)-5.137))))

in SQL:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

SELECT 1 - power(0.9240, exp((-0.2201*((71/10)-7.036))+(0.2467*(0-0.5642))-(0.5567*((60/5)-7.222))+(0.4510*(log(13.5)-5.137))))

In SQL i get the correct value, 0.0015 but in PowerBI I get
0.0007783428.

What do I need to change in my DAX expression so that it calculates the POWER() and EXP() and LOG() correctly?

>Solution :

I always recommend not doing technical translation from SQL to DAX so not to fall in similar situations.

WHat you have as a difference in the results can be due to the way each environment handles mathematical calculations, especially regarding the precision of floating-point operations and the implementation of the EXP(), POWER(), and LOG() functions.

Result = 
1 - POWER(
    0.9240, 
    EXP(
        -0.2201 * ((71 / 10) - 7.036) + 
        0.2467 * (0 - 0.5642) - 
        0.5567 * ((60 / 5) - 7.222) + 
        0.4510 * (LN(13.5) - 5.137)
    )
)

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading