Forum Discussion
Why does this measure work?
Hi all,
I have a measure to calculate the percentage of two other measures, and it does work, I just don't know why it works.
On Time = 149
Past Due = 1
I want the % of past due, so on a calculator I divide 149 by 1 and multiply x 100 and I get 0.67 which is great. If I do that in DAX, I get 0.01, which isn't great. That is just using a measure called Total = [past due] / [on time]. I'm just replicating what I do on a calculator and it doesn't work.
Now if I do this measure, I get the correct number - 0.67.
Total = [past due] / ([on time] + [past due]). I don't know why this works. Any ideas?
Hi randyrettig - your measure should be as below:
%measure = DIVIDE([past due],([on time] + [past due]))This divides the past due count by the total count (on time + past due).
I tested with sample i got it 0.01 after that you have to multiple with 100 . When you format this as a percentage, it becomes 0.67%, which matches your expected result
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!Hi randyrettig ,
Not sure if I got the essence of your error but looking at the measures you present both of them present the same value that is 0.01 (if rounded to 2 decimals) but be aware that since your values are very smal the measure look the same but they are not:
1/ 149 = 0.006711409
1 / (149 + 1) = 0.0066666
Believe that your problem is the lack of formatting has percentage this will give you the multiplication by 100 without writing it on the formula.
2 Replies
- rajendraongole1Super User
Hi randyrettig - your measure should be as below:
%measure = DIVIDE([past due],([on time] + [past due]))This divides the past due count by the total count (on time + past due).
I tested with sample i got it 0.01 after that you have to multiple with 100 . When you format this as a percentage, it becomes 0.67%, which matches your expected result
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!! - MFelixSuper User
Hi randyrettig ,
Not sure if I got the essence of your error but looking at the measures you present both of them present the same value that is 0.01 (if rounded to 2 decimals) but be aware that since your values are very smal the measure look the same but they are not:
1/ 149 = 0.006711409
1 / (149 + 1) = 0.0066666
Believe that your problem is the lack of formatting has percentage this will give you the multiplication by 100 without writing it on the formula.