Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7498819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:36:26+00:00 2026-05-29T19:36:26+00:00

When have a issue at work where the value returned by the SUM() function

  • 0

When have a issue at work where the value returned by the SUM() function isn’t treated like a “normal” number when using the value returned together with the Round() function.

Try this MDX for example

WITH 
MEMBER SomeNumber AS 0.595 
SET SomeNumberSet AS 
           {[SomeNumber], [SomeNumber], [SomeNumber], [SomeNumber], [SomeNumber], [SomeNumber], [SomeNumber], [SomeNumber] }

MEMBER SomeNumberSum AS
Round(SUM([SomeNumberSet], [Measures].[SomeNumber]) / 8, 2)


SELECT [SomeNumberSum] ON 0

FROM [SomeCube]

This code returns 0.59, the sum of sets are 4,76, which are then divided by 8 = 0,595. Since MDX is using Bankers rounding this SHOULD be rounded to 0.60.

Just using Round(0,595) gives us the correct result.

Whats even more strange is that if we in the set only uses the SomeNumber 6 times or less and in the Round Function divide with the same multiplier we get 0.6 (which is correct)

Also, if I wrap the Sum() with the StrToValue() function, it works, even if I use more than 5 SomeNumbers in the set

Whats going on?!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:36:28+00:00Added an answer on May 29, 2026 at 7:36 pm

    Not sure is the actual answer you’re looking for. The issue you’ve has to do with numerical precision, aka rounding errors, more than with MDX.

    If you’re in Java, run the following test :

    public void testNumeric()
    {
        double sum = 0.0;
        double value = 0.595;
    
        for (int i = 0; i < 8; i++)
        {
            sum += value;
        }
    
        double prod = value * 8;
        assertEquals(sum / 8, prod / 8);
    }
    

    The assert will fail, strange no ?

    Result : expected:<0.5949999999999999> but was:<0.595>
    

    The first one, sum, is how mdx is calculating the value. You got a slight difference, but it is enough for changing the result of the ROUND().

    Is there a solution ?

    Strictly speaking no, it’s an error due to the very nature of the numeric calculation with computers. Practically you can cheat a bit round first to 10 – ROUND(ROUND(MyNumber,10),2), not brillant (10 is an example).

    If you’re interested start in wikipedia from here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having an issue getting a LINQ query to work. I have this XML:
I have an issue that is driving me a bit nuts: Using a UserProfileManager
We have an issue using the PEAR libraries on Windows from PHP . Pear
I have an issue with using AWK to simply remove a field from a
I'm having a problem.. Actually I do have an issue when sending a value
I have an issue with using declarative helpers in the App_Code directory. I created
I have some strange issue using jQuery Validation plugin. Firs of all here is
I have a 3rd party script that loops through every returned value and echos
I have an issue with setlocale() in PHP when using functions such as money_format()
I have a reference application that I use to work through DDD issues, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.