In BAQ, all decimals after division are displayed as 0. How to handle this?
On the Display Columns screen, there is a format field you can use. It is under the Calculated Field SQL Editor on your second screenshot.
I think this happens when doing arithmetic with an integer (the count field, here). It rounds the result to an integer.
I think you have to cast the count to a decimal or other smart-people stuff.
Hmm. I was expecting integer.
I’m still suspicious that it sees it as an integer anyway.
That’s interesting.
“Format” is internal BAQ definition, if SQL server thinks that data is integer it processes it as integer, so you are right in you expectation
Replace “then 0 else” with “then 0.0 else” to prevent the system from implicitly casting your field as an integer.
Go upstream to whatever “Main” is and look at the calculations there. Whenever you have a case statement, SQL can collapse your decimal column into an int when one of the possible results is an integer. You have to make sure every possible outcome is a decimal.
The BAQ column type is just a cast on the final result. If you’ve already lost precision it won’t bring it back.