Forum Discussion
DAX query and Matrix visual showing different results
In PowerBI Desktop ( 2.132.1053.0 64-bit (augustus 2024)) I have a report with a Matrix visual.
This visual has a hierachy (of fields) and 3 measures. All works fine except for some values.
In one measure the values displayed in the visual are different than the results from the underlaying DAX query. The Yellow marked value in the Matrix (7.999999999999998) is different the results from the DAX query which I retreive via "Performance Analyser" -> "Run in Dax Query View".
The results the in the Dax Query analyzer is 8 (as it should be) instead of 7.999999999999998.
Any suggestions how to resolve/where to check? Or is this a Bug in PowerBI visual?
Performance analyzer panel:
Value is 7.999999999999998 in Matrix in the report:
Value is 8 in Dax Query analyzer:
2 Replies
- Vidushi_MangalRegular Visitor
Even if you are not explicitly using rounding functions, DAX might still display rounded values due to the following reasons:
Implicit Conversion and Data Types
Floating-Point Arithmetic Limitations
Display Formatting: The way DAX displays numbers can also create the illusion of rounding. By default, DAX might show fewer decimal places than the actual value stored in memory.
Here's what you can do:
Check Data Types: Ensure that the columns involved in your calculation are of appropriate data types like use Decimal or Double for high-precision floating-point numbers.
Explicitly Control Formatting: If you need to display the full precision of a number, use formatting options to specify the desired number of decimal places using functions like "FORMAT".
Use the Decimal Data Type in Calculations: If you require very high precision, consider performing your calculations using the "Decimal" data type, which offers greater accuracy for decimal numbers compared to floating-point types.
Nature of Floating-Point Numbers: Understand that floating-point arithmetic inherently involves some level of approximation. If absolute precision is critical, consider alternative approaches or libraries designed for high-precision numerical computations.
Give thums up if you find the answer
- Ray_Minds
Solution Supplier
Hi EmielvdR
If the measure is using other measure values for calculation then you need to keep the data type fixed decimal for high precision in the column that is getting used in the measure calculation and then, you can simply change the data type of the measure in a whole number to get the expected result.