15

A user trying to check the Sales Amount per Salesperson. Sample data:

Salesperson   Sales Amount    
001                   1000    
002                    500    
003                    750
Grand Total:          2250

It looks fine, but we have the following hierarchy Company > Class > Group > Subgroup in the cube and if a user tries to use this hierarchy in filters - Grand Total fails (if any attribute is unchecked in this hierarchy). Sample:

Salesperson   Sales Amount    
001                   1000    
002                    500    
003                    750    
Grand Total:           350

I've noticed the same problem before when we tried to filter Date attribute, if not every day of the month was selected it shown wrong Grand Total too.

Have you an idea why it happens and how to fix it?

Sales Amount is physical measure (not calculated measure), it is selected from SQL view (the same happens with every fact).

Wrong Grand Total

I've asked the same question here, but nobody could answer it.

I've tried to delete all MDX calculations (scopes), but still Grand Total was incorrect.

Clean MDX Calculations

Wrong Grand Total

EDIT

I've noticed that the problem occurs when filtering like that:

Hierarchy filter

1 element selected from the first level of the hierarchy, 1 element from 2nd level and 1 element from the 3rd level of hierarchy as in the image above.

If the 3rd level isn't filtered it shows good Grand Total.

EDIT 2

I've tried to trace on SSAS, it returns exactly the same output as in Excel. It generated the following MDX when using Salesperson dimension on the rows:

SELECT NON EMPTY { [Measures].[Sales Amount] } ON COLUMNS, 
NON EMPTY { ([Salesperson].[Salesperson].[Salesperson].ALLMEMBERS ) } 
DIMENSION PROPERTIES MEMBER_CAPTION, 
MEMBER_UNIQUE_NAME ON ROWS FROM ( 
SELECT ( {  [Item].[Class - Group - Subgroup].[Class].&[XXX]&[1.], 
            [Item].[Class - Group - Subgroup].[Group].&[XXX]&[2.]&[2.2.], 
            [Item].[Class - Group - Subgroup].[Subgroup].&[XXX]&[2.]&[2.3.]&[2.3.1.] } 
) ON COLUMNS FROM ( SELECT ( { [Company].[Company].&[XXX] } ) ON COLUMNS 
FROM [Sales])) 
WHERE ( [Company].[Company].&[XXX], [Item].[Class - Group - Subgroup].CurrentMember ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

This MDX generated without Salesperson dimension:

SELECT NON EMPTY { [Measures].[Sales Amount] } ON COLUMNS 
FROM ( SELECT ( { [Item].[Class - Group - Subgroup].[Class].&[XXX]&[1.], 
[Item].[Class - Group - Subgroup].[Group].&[XXX]&[2.]&[2.2.], 
[Item].[Class - Group - Subgroup].[Subgroup].&[XXX]&[2.]&[2.3.]&[2.3.1.] } ) ON COLUMNS 
FROM ( SELECT ( { [Company].[Company].&[XXX] } ) ON COLUMNS 
FROM [Sales])) WHERE ( [Company].[Company].&[XXX], [Item].[Class - Group - Subgroup].CurrentMember ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

I've noticed even if I'm not using any dimension on the rows (in samples above I've used Salesperson dimension) it shows wrong Grand Total.

For example it shows:

Sales Amount 
350

And when using Salesperson dimension on the rows:

Salesperson   Sales Amount    
001                   1000    
002                    500    
003                    750    
Grand Total:           350
Infinity
  • 828
  • 4
  • 15
  • 41
  • Have you tried debugging the difference by comparing the details of the 'Grand Total' *(`.ShowDetail`)* with the `Rows`. That should give an idea of where the difference is, incresing your chances of identifying the cause of the problem. – EEM Apr 30 '19 at 11:57
  • @EEM thank you for the suggestion, but I can't debug like that. `ShowDetails` can be used when only 1 attribute is selected in the filters list. Check the following error: https://i.ibb.co/QjRMgrT/Error.png When only 1 element is selected in filters it shows correct Grand Totals. It fails when I check a few (but not all) elements from the hierarchy (2-3rd level), sample: https://i.ibb.co/vDNCRZq/Sample-Of-Selection.png So this debug not working to solve this problem. – Infinity Apr 30 '19 at 12:33
  • Could you start trace on SSAS, capture actual MDX executed and run this MDX using Management studio? – Piotr Palka May 06 '19 at 15:10
  • Is there any row level security enabled for this dimension? – Piotr Palka May 06 '19 at 15:19
  • @Piotr I have access to execute MDX using Management Studio, but I have no ideas how could it help me. As I've mentioned before, I've tried to delete all MDX calculations and still grand total was incorrect. There are some roles in the cube, but those roles don't affect me, I have full access to the cube. – Infinity May 07 '19 at 06:21
  • What I mean is to start a trace on SSAS server and it will allow you to save actual MDX executed by Excel. After saving it try to run it in SSMS and compare results. It will help you to identify where the error is happening: MDX generation, MDX execution or Excel itself. – Piotr Palka May 07 '19 at 14:39
  • @Piotr thank you for your time. I've tried it, I've got exactly the same output as in the Excel. I've updated my question with `EDIT 2` sections, check it out, please. I've attached generated MDX queries. – Infinity May 08 '19 at 12:26
  • I think it is time to open Microsoft support ticket, hard to figure anything out without access to the database. – Piotr Palka May 08 '19 at 14:50
  • @Piotr $500 to open a support ticket? I've tried to describe my problem here https://support.microsoft.com/en-us/supportforbusiness/productselection and in 3rd step, they're asking to choose a plan for $500 or am I in the wrong place? – Infinity May 09 '19 at 07:01
  • 1
    I don't know. I have Visual Studio (previously MSDN) subscription, which includes some tickets and then we have enterprise agreement. Check if anyone has it in your organization. https://learn.microsoft.com/en-us/visualstudio/subscriptions/vs-tech-support – Piotr Palka May 09 '19 at 14:47

1 Answers1

1

I would like to take another angle to this one and suggest that it is not SQL/SSAS that is the problem here but Excel. In a pivot table with subtotals and grand totals the totals are not calculated by the cube but the client-side application. I have experienced this a few times and found this to be a known issue with Excel. The solution typically involves creating a new calculated field in Excel to provide the grand total. This is frustrating especially if Excel is the go-to client application for other users accessing the cube. If it is any consolation, I've also experienced this a time or two in other tools such as Tableau but for slightly different reasons with different solutions.

Here is a link to a Microsoft KB acknowledging the problem. Affects versions 2003-2019!!!

https://support.microsoft.com/en-us/help/211470/calculated-field-returns-incorrect-grand-total-in-excel

Adam Rene
  • 41
  • 2
  • Thank you for your answer, but looks like I have a different problem than that listed in your provided link. This is physical measure (not a calculated field), the aggregate function is set to sum and there is no multiplication, maybe it's Excel's bug but looks like different than that. – Infinity May 07 '19 at 06:35
  • The known issue with Excel is that it does not provide correct totals for physical measures. My answer is that the SOLUTION (not the problem) is to create a calculated field in Excel. I know it is hard to believe this is an ongoing and wide-ranging Excel bug but alas it is! :) – Adam Rene May 31 '19 at 12:44