Float data types

I don't really know SSAS but have been a .NET programmer and worked with SQL Server and T-SQL for years.  I am working on a project where there is a database storing sales transactions and a cube that is created nightly so we can get MTD Sales, YTD
Sales, Profit $, etc.
I just ran into an issue where I got an error retrieving the Profit $ measure (using an MDX query inside of a SQL stored procedure using OPENQUERY) and found that the profit $ should be 0.07 but is coming back as 6.9999999999993179E-2. After talking
to our DBA, he said all of the calculations in the cube are double precision floating point and I need to round all results to 2 decimal places (programs like Excel handle the rounding and I should too.)
Our DBA also claims the measures can't be calculated and returned as currency. He claims that the potential for error is very small and no one has ever complained about a $ value being off.
I am struggling with this answer because I have always been told never to use floating point for monetary values.  I am having a hard time believing there is no way to have a measure be a currency field that is accurate.  I looked for articles
online but can't seem to find anything to answer my questions.
Could someone please point me in the right direction? Thanks so much!

Your DBA is not completely correct in his claims. All calculations are not floating point below is a link to all of the data types supported by SSAS (Multi-Dimensional)
https://technet.microsoft.com/en-us/library/gg471558%28v=sql.110%29.aspx?f=255&MSPPError=-2147217396
SSAS supports a currency data type. It's 4 decimal places not 2, but it is the recommended data type for currency values as it does not suffer from the imprecision of the double data type.
The other thing measures in a cube have is the concept of a format string, so you can ask the cube to return a pre-formatted value to you. But default an OPENQUERY will just return the raw value, but if you add the following:
CELL PROPERTIES FORMATTED_VALUE
to the end of your MDX query that should tell it to return the formatted value (which could be something like "$#,##0.00")
See here https://msdn.microsoft.com/en-us/library/ms146084.aspx for a list of all the different format masks that can be applied
http://darren.gosbell.com - please mark correct answers

Similar Messages

  • How to configure oracle 8.1.6, 8.1.7 for recognizing float data type by  ODBC

    I know oracle recognizes float data type into the tables, and exists a parameter in the initialization parameters named NLS_NUMERIC_CHARACTER that permits to us change the presentation format. I did it, and into the server pc now it shows me '.' as a decimal point and ',' as a group separator. So, how can i do for the clients recognize the same float data type format. Which file i have to modify, or always i have to execute the instruction: alter session set NLS_NUMERIC_CHARACTERS = ".," in every client machine?
    thanks
    aldemar

    According to the National Language Support Guide, available from <http://tahiti.oracle.com>, you should be able to change the value of NLS_NUMERIC_CHARACTERS in the init.ora file for the database and have that carry across to all sessions.
    Justin

  • Reports with FLOAT data  type

    I am trying to create a simple report form from a table which contains a FLOAT data column.
    I follow these steps:
    New>Component>Report>Report with Form...
    I end up with 2-pages: the report and the entry form to update/create a row. The key-column on the report page links to the entry-form page and all values from the selected report row carry-over to the entry-form for an update with the exception of the FLOAT column. This seems to be an issue with fetching the row values when the entry-form is loaded. The FLOAT values entered manually in the form are saved. This issue is related to the FLOAT data type. When I altered the column data type to NUMBER(10,2) the value on the entry-form started appearing.

    200972,
    Our automated row fetch module (used by wizard-generated form pages) recognizes only the NUMBER datatype for numbers. I'll log this as an enhancement request.
    57434

  • Float data type problem!

    Hi ALL,
    I have a problem with float data type. Please tell me how to fix it if you know.
    THANKS!
    Source code:
    class testFloatType {
    public static void main(String args[]) {
    float i = 0.9f, j = 0.8f, k = 0.1f;
    System.out.println("i = " + i);
    System.out.println("j = " + j);
    System.out.println("k = " + k);
    System.out.println("i - j = " + (i - j));
    System.out.println("i - k = " + (i - k));
    Result:
    i = 0.9
    j = 0.8
    k = 0.1
    i - j = 0.099999964
    i - k = 0.79999995

    Hi garazdawi,
    I try to use the double to instead of float, but it still has a bit error!
    Source code:
    class testFloatType {
    public static void main(String args[]) {
    float i = 0.9f, j = 0.8f, k = 0.1f;
    System.out.println("i = " + i);
    System.out.println("j = " + j);
    System.out.println("k = " + k);
    System.out.println("i - j = " + (i - j));
    System.out.println("i - k = " + (i - k));
    double a = 0.9d, b = 0.8d, c = 0.1d;
    System.out.println("a = " + a);
    System.out.println("b = " + b);
    System.out.println("c = " + c);
    System.out.println("a - b = " + (a - b));
    System.out.println("a - c = " + (a - c));
    Result:
    i = 0.9
    j = 0.8
    k = 0.1
    i - j = 0.099999964
    i - k = 0.79999995
    a = 0.9
    b = 0.8
    c = 0.1
    a - b = 0.09999999999999998
    a - c = 0.8

  • Getting precision length  for float data type

    Hi All,
    We trying to find the precision length of a float (126) data type. Are there any built in functions in oracle for finding the same? E.g: the function should return 5 for the value 1.23456 .
    Also, are there any table level operation to reduce the decimal precision of a float 126 field?
    Regards,
    Raj.

    Not sure if this is what you're looking for:
    select data_precision from all_tab_columns
    where owner = '<your schema name>'
    and table_name = '<your table name>'
    and column_name = '<name of column in table>';
    or are you looking for a particular find_precision_in_number() function...
    i can't think of one off the top of my head, but you can always do:
    length(substr(<colname>, instr(<colname>, '.')+1))

  • Storeing values in floate data type upto two decimal places

    Hi
    I want a float type field in my table but want to store value up to two decimal places.
    so what syntax i need to follow plz suggest.
    thanks

    it is not possible to store with Number datatype. if you are using the data to sho report, then change its format (like 45 to 45.00). if you want to store 45.00 in database, then you have to modify the datatype for that column. for this follow the following path
    1. Add a column of datatype Varchar2.
    2. Copy all the value of your number field to it.
    3. Drop the old column.
    4. However make sure that if you have used that column somewhare in arithmetic calculation, the modify it and use to_number function to do arithmetic opration.

  • What is the difference btwn double and floating data type?

    is it going to affect the computation?

    What is the difference btwn J2SDK and J2EEhttp://java.sun.com/j2se/index.jsp
    http://java.sun.com/j2ee/index.jsp

  • Cannot get the correct data type in Oracle JDBC

    Dear ALL:
    I used JDBC ResultSetMetaData to get the column data type for Oracle Database. I created a table including 2 columns AAA, which is NUMBER type, BBB which is FLOAT type.
    However, I found a problem that either NUMBER or FLOAT data types are reported as NUMBER type in JDBC.
    IN SQL 2000, it is okay. SMALLINT, INT, TINYINT, etc..can be reported correctly.
    Can anybody tell me that what's wrong here? I will be very appreciated.

    hi,
    i guess its a bug which is fixed with 10i.
    Elango.

  • Float Data Value and Scientific Notation

    Hello All,
    SQL Server converts some of the float value into scientific notation for example 0.00001 will be stored as
    1E-05.
    Is there any simple method\formula\threshold to precisely tell when some particular value will be converted to scientific notation?
    Also I think oracle store same value above i.e. 0.00001 as it is with float data type but not the case with SQL Server. Any reason for the same?
    Thanks in Advance.
    -Malkesh

    Thanks Erland.
    I got your point that internal storage as you mentioned will be 53 bit and 11 bit exponent of 2. However my question remains the same that is there any method\threshold from which we can say that after this numeric value stored data will be represented in
    scientific notation or any rule of thumb? For example
    drop
    table #t
    CREATE
    TABLE #T (T1
    FLOAT)
    INSERT
    INTO #T (T1)
    SELECT 0.000001
    INSERT
    INTO #T (T1)
    SELECT 0.00001
    INSERT
    INTO #T (T1)
    SELECT 0.0001
    INSERT
    INTO #T (T1)
    SELECT 0.001
    INSERT
    INTO #T (T1)
    SELECT 0.01
    INSERT
    INTO #T (T1)
    SELECT 0.1
    INSERT
    INTO #T (T1)
    SELECT 1.
    INSERT
    INTO #T (T1)
    SELECT 1.0
    INSERT
    INTO #T (T1)
    SELECT 1.01
    INSERT
    INTO #T (T1)
    SELECT 1.001
    INSERT
    INTO #T (T1)
    SELECT 1.0001
    INSERT
    INTO #T (T1)
    SELECT 1.00001
    INSERT
    INTO #T (T1)
    SELECT 1.000001
    INSERT
    INTO #T (T1)
    SELECT 1.0000001
    INSERT
    INTO #T (T1)
    SELECT 1.00000001
    INSERT
    INTO #T (T1)
    SELECT 1.000000001
    INSERT
    INTO #T (T1)
    SELECT 1.0000000001
    INSERT
    INTO #T (T1)
    SELECT 1.00000000001
    INSERT
    INTO #T (T1)
    SELECT 1.000000000001
    INSERT
    INTO #T (T1)
    SELECT 1.1
    INSERT
    INTO #T (T1)
    SELECT 10.1
    INSERT
    INTO #T (T1)
    SELECT 100.1
    INSERT
    INTO #T (T1)
    SELECT 1000.1
    INSERT
    INTO #T (T1)
    SELECT 10000.1
    INSERT
    INTO #T (T1)
    SELECT 100000.1
    INSERT
    INTO #T (T1)
    SELECT 1000000.1
    INSERT
    INTO #T (T1)
    SELECT 10000000.1
    INSERT
    INTO #T (T1)
    SELECT 100000000.1
    INSERT
    INTO #T (T1)
    SELECT 1000000000.1
    INSERT
    INTO #T (T1)
    SELECT 10000000000.1
    INSERT
    INTO #T (T1)
    SELECT 100000000000.1
    INSERT
    INTO #T (T1)
    SELECT 1000000000000.1
    SELECT T1
    FROM #T
    Here you can see value < 0.0001 i.e. 0.00001 and 0.000001 both are in scientific notation. So which rule or formula drives this behavior that is what my question is. Sorry I am somewhat poor in mathematics fundamentals So if you can make it simple.
    Thanks Again.

  • Mapping Float with data type Qty or Curr or INT4

    Hi,
    We are extracting the data from a table. Some fields are defined as Float but at trasfer rules we have mapped those Key figures with Quantity or Currency or INT4 .
    In transfer rules there is only info object mapping. But when extracting the data we are not getting any data even In PSA for those fields.
    Please suggest should we change the data type or any changes
    Thanks,
    Shaliny. M

    Hi,
    Can you provide some more inputs.
    have you mapped with Standard Fields.
    Reg
    Pra

  • Pack  and Floating Point Data Type in ABAP

    Dear All,
    I am new to ABAP. Started with data types. Came across pack and floating point.
    Please let me know what PACK  and Floating Point stands for with few examples and the main difference between them.
    Regards
    Arun V

    Hi,
    You'd better ask this question in ABAP forum http://forums.sdn.sap.com/forum.jspa?forumID=50 .
    Best Regards,
    Ada

  • Function module to convert float value to data type 'dec'

    Hi experts,
      In a report i need to convert float value to the data type 'DEC'. How to convert it. Is there any function module for this conversion.
    Thanks and Regards,
    Vaibhav Tiwari.

    Hi ..
    We can do like this...
    Data : V_float type F value '12345.67'.
    Data: V_dec type P Decimals 2.
    Write:/ V_float exponent 0. "This will display it like Type P
    or
    Write V_float to V_dec EXPONENT 0.
    Write:/ V_dec.
    reward if Helpful.
    <b></b>

  • Arithmetic Overflow error converting float to data type numeric

    Hi,
    Am facing strange issue,I have function which returns money datatype and assigning the return money value to float datatype in table.
    Error msg:
    Msg 8115, Level 16, State 6, Procedure GBCalcCatalogPriceNewV2, Line 204
    Arithmetic overflow error converting float to data type numeric.
    The statement has been terminated.
    Strange thing is the same stored procedure is working fine in production environment,but in the deveopment i see this error.Am scared if the same happens in the production environment.Please advice and advance
    thanks
    Regards
    RAj

    Strange thing is the same stored procedure is working fine in production environment,
    How could that be strange? This is an error that occurs depending on the data. Accidents that are waiting to happen will happen sooner or later.
    Then again, a development database may be more prone to such errors, because data that entered are completely out of whack with real life data. Still it is a warning sign. If you have some place where you convert data from float to numeric, you must consider
    the risk that the float value is outside the range for the numeric data type. How do you prevent that from happening? Maybe a CHECK constraint on the column? Of if the data origins from a money column, use a numeric data type with sufficient precision.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Bulid in Data type float

    While using the bulid in data type float .
    we get output Like 123.440000000000000000000+e0
    i just want to print upto 2 places of deicmal.
    please help.

    Hi Lokesh,
    use statement:
    write variable_name decimals 2.
    where variable_name is of type f or p.
    Regards,
    yellappa.

  • Profibus data type converting to floating point

    Hi, 
    Is there an efficient way to convert  the incoming data to the floating point in the NI cRIO Profibus system? 
    1) The system is : NI cRIO 9068 Controller with Comsoft profibus slave module. The lavview we are using is 2013. 
    2) We are using profibus slave example and are able to see a array of unsigned 8 bit data. Please see the Output data shown in the attachement.
    3) On the other side of profibus system, thrid party profibus master are converting floating points and tranmit the converted data to NI profibus slave. 
    Attachments:
    Screenshoot.png ‏7 KB

    If it's just a matter of converting data types once you have the data in LabVIEW, you can always manually scale and convert the data using the arithmetic functions and the "To Double Precision Float" or "To Single Precision Float" functions. You just have to know what floating point value the unsigned byte integer corresponds to. Is that what you're asking?
    If you're asking for a way to this inherently with the Profibus functions, I'm afraid I can't be of much help...
    Ryan K.

Maybe you are looking for

  • Ora-1460 during select using table(cast(type))

    Hi all! I've got a problem with a query that fails with a ora-1460 at random time intervals. This is a 10.2.0.3 version database running on a sun os. We've managed to reproduce this error controlled when running an analyze on the table in question at

  • Need to know the Business Package for CRM4.0 Sales in EP6.0

    Hi experts,   We are trying to implement the CRM4.0 Sales business package in our EP6.0 environment( Our Backend R/3 is in 4.6B) . We would like to install complete package for the Sales module (The main (Top level) menus in the portal look like the

  • I can't open community pages or activity ?

    My enter net is slowly and I can't open the apple pages .

  • Trying to join sales numbers - having trouble

    I'm very new to Sql. I'm trying to join two queries into one. They each work independently, but when I try to combine them I get duplication - the same part is listed numerous times. I know it's something simple, but I can't figure it out. Any help w

  • Alternatives to "explore" / profile BW cube

    We have implemented Solution Manager Diagnostics which is generating cubes in the Solution Manager onboard BW system.  Our goal is to expand on (customize) the existing dashboards that SAP supplies with Solution Manager. Towards this end we are tryin