PRB: Division by Zero Displays Results in Strange FormatID: Q219176
|
If a 'division by zero' operation is performed in a MDX query, the results appear in a strange format such as "1.#J". Some examples follow:
Format Strings | Query Return Values |
---|---|
FORMAT_STRING=" | 1.#INF |
FORMAT_STRING='Standard' | 1.#J |
FORMAT_STRING='Fixed' | 1.#J |
FORMAT_STRING='Percent' | 1#I.NF% |
FORMAT_STRING='Scientific' | 1.JE+00 |
In general, avoid division by zero whenever possible. Inside a calculated member, use explicit checking before dividing. For example, instead of the expression 'Sales / Units', use the function 'iif' such as 'iif ( Units = 0, 0, Sales / Units )'.
NOTE: The explicit checking may not always work. It will work for integer values, but may fail for real values.
This functionality is provided by the Oleaut32.dll file. This is how the OLE Automation function formats numbers. The same behavior can be seen in Visual Basic's Format function, or in any product using OLE Automation.
Additional query words:
Keywords : SSOSmxd kbSQLServ700
Version : winnt:7.0
Platform : winnt
Issue type : kbprb
Last Reviewed: June 4, 1999