Thursday, March 29, 2012

Datatype problem?

Hello
We ahve a problem with datatypes. I the cube whe have 2 mesasures (Item_Sold and Sales). Item_sold is Numeric datatype and Sales is Currency. In the virtual cube whe divide the to in to a average price (Sales/Item_sold).
We user Excel show the cube.
For integer numbers we get no problem but for item_sold with decimal values (like 1,43) the division get currupt. It seems that it only devide the integer so average measures of:
Item_sold=2,5
Sales=500
...will be 250 (500/2). And if the item_sold is smaller than 1 (for units smaller than 1 kilo) the average value will even more strange.

I think that the datatyp is the error. What datatyp shall i use?

I am also getting this strange problem

What is happening is that when something is being divided by 0.XX its producing those wrong figures where decimal is at a wrong place. But if we divide the numerator and denominator by 100, we get the correct figures.

Something *100 / 0.XX *100 = good

Something / 0.XX = wrong

|||

OK,

I found the solution. Its related to data types. Make sure that both the denominator and the numenator are of same data type (may be numberic)

It solved my problem

sql