cancel
Showing results for 
Search instead for 
Did you mean: 

Calculated Measure - Decimal precision

Former Member
0 Kudos

Hi,

I am trying to create a calculated measure result = (occupied seats / maximum seats)*100, (These 2 columns are of data type integer and result is of the data type decimal 5,2). The result is just showing "0.0" for all the values, instead of the actual precision (values after decimals) wherever valid is just says "1.0" but most of the cases its "0.0" instead of the actual values.

The calculation looks simple, but I am not able to derive the actual value

Can someone help in this calculation.

Thanks!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sunil,

Can you try giving data type as DOUBLE(as a workaround) and check if it works.

It might be an issue(bug) with DECIMAL data type in calculated measure..

Regards, Rahul

Former Member
0 Kudos

Hi Rahul,

I've tried all the data types available in there while we create a "calculated measure"

Anyways, thanks for your response.

Thanks,

Former Member
0 Kudos

Hi Sunil,

Please try as follows:

Define result as: (float(occupied seats) / maximum seats)*100

You can define the result as Decimal and it should work..

Regards, Rahul

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sunil,

You are stuck because of your both the data type you are working with "occupied seats" and "maximum seats" are integers so if you divide them you got the intermediate result as INTEGER then it convert integer as double by truncating the precision , so you got ZERO because occupied seat and maximum seat difference is low. Try once to take occupied seat as 50 and maxim seat as 2 or 3 then you get the difference.

To get the desire result you can do one of the things as below:

1. Need to take one of the data type as Double or decimal.

2. or firstly create one calculated measure(say IntermediateResult)  to convert one of the measure (say occupied seats) in decimal or double, then perform your operation on it like (intermediateResult / maximum seats)*100, so that your intermediate result also save in decimal not as integer.

-Ruchi