Problem in SSAS with AVG command

FernandoCar 21 Reputation points
2022-01-05T20:13:33.347+00:00

I have a cube in SSAS, I need to get the average of a field, the values of this field are all positive values, when I create a calculated member in SSAS:
"AVG ([Measures]. [Rent])"
The results are negative values (not always, they change as I add dimensions)

When I do the calculation in T-SQL the results are correct:

162580-image.png

But when I do the calculation in SSAS the results are random:

162612-image.png

When I add another dimension the results start to change:

162613-image.png

When you started the problem I changed the data type from int to bigint but I have not had good results either, this is the calculated member:

162540-image.png

SQL Server Integration Services
SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
SQL Server | Other
0 comments No comments
{count} votes

Answer accepted by question author
  1. CarrinWu-MSFT 6,891 Reputation points
    2022-01-06T07:19:09.81+00:00

    Hi @FernandoCar ,

    Welcome to Microsoft Q&A!

    From the T-SQL, you were calculate average values for one column. However, in SSAS cube, you were created a calculated member. A Calculated Member is a custom MDX expression that defines a member in any hierarchy in the cube. When you create a calculated member, it’s better to create two physical measures [Sum] and [Count] and then create a calculated measure to calculate average. If you would like to calculate average value for one coulumn, please try to create a measure. For more information, please refer to below links:
    Average aggregation in measures – SSAS Cube
    this thread
    Create Measures and Measure Groups in Multidimensional Models

    Best regards,
    Carrin


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.