Calculated Field showing wrong value, incorrect result

If you have a calculated field that seems to be coming up with the wrong answer, such as 1 / 2 = 0 as shown below for the calculation x / y = 0 :

and you might think that all you need to do is to modify the Format to show 2 decimal places instead of no decimal place in the result to fix the problem....but that doesn't seem to work!!!!

this is not due to some Yellowfin bug as you may think, instead, it is actually the underlying data source showing an INTEGER result thus losing the decimal part of the full result, i.e. showing 0 instead of 0.5

Thankfully there is an easy way resolve this issue, multiply the numerator by a float which implicitly forces a cast to a float for the result. Using our previous example, you would have to change the calculation to (1.0 * 1) / 2 = 0.5 as shown below:

which yields the following results:

Is article helpful?