Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Help with dividing values

Hi! 

 

I need help with dividing two values to create a new measure. This measure should show the sum of X divided by Y. However, after creating such a measure, the output is a bit off. My two values are 19 and 26, and when I divide those two values Power BI gives me 79.2%, but this is not correct as 19 / 26 = 73.1%. 

 

The DAX expression I have created in order to give the faulty output is: 

CALCULATE(COUNTROWS(Tablename1)/sum(Tablename2[columnname]))
 
Hopefully you can help as I do not see what I am doing wrong but still getting the faulty output.
 
Thanks!

4 Replies

  • Anonymous , Try like , see if that give better result. Also change decimal place to 2 and check

    CALCULATE(divide(COUNTROWS(Tablename1)*1.0,sum(Tablename2[columnname])))

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi, 

       

      Thank you for answering but it still gives me the same faulty output, same number.. Not really sure why it does not show the correct value

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi again, 

       

      So the measure is correct however when I apply filters (such as date) this is when the output becomes wrong. The standard deviation also increases the lower the values I wish to divide. So for instance 2 / 3 is more faulty than 200 / 300 .

  • v-deddai1-msft's avatar
    v-deddai1-msft
    Community Support

    Hi Anonymous ,

     

    It'e better that you can show us some sample data (sample pbix file ) by onedrive for business for referenece. Then we can can help you well.

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Dedmon Dai