Forum Discussion
DAX function not calculating decimal values correctly.
- Anonymous1 year ago
abansalgeoforce, Looks like Power BI is auto-converting the result to a fixed decimal with low precision at some point in the DAX chain.
column1 here is set to decimal with 3 precision.
And the below calculation is giving me value 0.40 instead of 0.33
"var1 > 5 &&var1 <= 10, (var1 - 5) / 5" ,
var1= 6.66
(6.66-5)/5 = 1.66/5 = 0.332.
Even if its rounding to 2 decimals, i should get value as 0.33. However, the value i finally get is 0.40.
The final measure (for which DAX formula i provided above) is set to decimal,2. However, with the interim calculation not being correct, the value is 0.40 instead of 0.33.
Hi abansalgeoforce,
The issue could be caused by implicit type conversion or a column misreference in your DAX logic.
Try with simplified test measure to isolate the issue
If you still see 0.40 instead of 0.332: It's likely that column1 is being rounded earlier, possibly in Power Query.
Regards,
Vinay Pabbu
- abansalgeoforce1 year agoFrequent Visitor
Thanks Anonymous . I tried exactly the same. When I use just column1, I see value 6.66. When I do column1-1, I get 1.66. The moment I do (column1-1)/5, I get 0.4
- Anonymous1 year agoNot applicable
abansalgeoforce, Looks like Power BI is auto-converting the result to a fixed decimal with low precision at some point in the DAX chain.
- Anonymous1 year agoNot applicable
Hi abansalgeoforce,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.
Regards,
Vinay Pabbu