dbTalk Databases Forums  

Total with MDX

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Total with MDX in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
florian
 
Posts: n/a

Default Total with MDX - 08-08-2006 , 10:15 AM






SELECT NON EMPTY { [Measures].[Patient Stay Count], [Measures].[Length
of Stay], [Measures].[Patient Count] } ON COLUMNS,

NON EMPTY { ([Patient Stay].[Gender].[Gender].ALLMEMBERS ),

([Patient Stay].[Gender].[M].Parent as Total ) } -----> this line
should build me the sum

DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
[Clinical Performance] CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR,
FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

I'd like to add a total in a table. Unfortunately I can't sum the
values up and so I have to use MDX to do it. I thought of calculating
the sum via this statement:

([Patient Stay].[Gender].[M].Parent as Total ) - I'd like to use the
root element as a total line. This gives me the right figures. But in
my first column and last row gender is Null (because it can not be
calculated) and instead I'd like to write Total in this field. How can
I achieve this?

Second best would be to life with the Null value but unfortunately I
can't display the result data with reporting services (I guess because
of the NULL).

Thanks


Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Total with MDX - 08-08-2006 , 07:21 PM






One standard technique with Reporting Services, which might work for
you, is to add a calaculated measure for the name:

Quote:
With Member [Measures].[GenderName] as
iif([Patient Stay].[Gender].CurrentMember is
[Patient Stay].[Gender].[All], "Total",
[Patient Stay].[Gender].CurrentMember.Name)
SELECT NON EMPTY {[Measures].[GenderName],
[Measures].[Patient Stay Count],
[Measures].[Length of Stay],
[Measures].[Patient Count] } ON COLUMNS,
NON EMPTY {[Patient Stay].[Gender].[Gender].ALLMEMBERS,
[Patient Stay].[Gender].[All}
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
[Clinical Performance] CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR,
FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #3  
Old   
florian
 
Posts: n/a

Default Re: Total with MDX - 08-09-2006 , 03:51 AM



Thanks for your thoughts. Unfortunately it doesn't work. In the Data
View my table looks like this:

Gender GenderName Patient Stays ............
M M 12
F F 23
(NULL) Total 35

When I want to display these results in the layout view and preview it
the row with the total is not shown. I guess it is because Gender is no
colum but works as a row and the last row with NULL in it is therefor
not shown.

Any ideas to solve my problem?

Thanks Florian

Deepak Puri schrieb:

Quote:
One standard technique with Reporting Services, which might work for
you, is to add a calaculated measure for the name:


With Member [Measures].[GenderName] as
iif([Patient Stay].[Gender].CurrentMember is
[Patient Stay].[Gender].[All], "Total",
[Patient Stay].[Gender].CurrentMember.Name)
SELECT NON EMPTY {[Measures].[GenderName],
[Measures].[Patient Stay Count],
[Measures].[Length of Stay],
[Measures].[Patient Count] } ON COLUMNS,
NON EMPTY {[Patient Stay].[Gender].[Gender].ALLMEMBERS,
[Patient Stay].[Gender].[All}
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
[Clinical Performance] CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR,
FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #4  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Total with MDX - 08-09-2006 , 09:07 AM



In the report data set, are you using the OLE DB for OLAP Provider
(which should work)? I think that there may be problems with returning
the parent row, when using the Analysis Services Provider. Also, in the
report design, only the GenderName field should be used, not Gender.


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #5  
Old   
florian
 
Posts: n/a

Default Re: Total with MDX - 08-09-2006 , 09:31 AM



Where can I see where which OLAP Provider I'm using?

I only used the GenderName.

My problem is that my report is a little more complex - my matrix looks
like this:


Q1 Q2 total
TownA Patients
Patient Stay

Patient Stays is simply summed up but patients is a "distinct" sum and
the total can't be calculated as a sum because I also have to keep in
mind that I need a distinct sum.

By the way when I use :

With Member [Measures].[GenderName] as
iif([Patient Stay].[Gender].CurrentMember is
[Patient Stay].[Gender].[All], "Total",
[Patient Stay].[Gender].CurrentMember.Name)
SELECT NON EMPTY {[Measures].[GenderName],
[Measures].[Patient Stay Count],
[Measures].[Length of Stay],
[Measures].[Patient Count] } ON COLUMNS,

NON EMPTY {[Patient Stay].[Gender].[Gender].ALLMEMBERS,
[Patient Stay].[Gender].[All}




---> and delete [Patient Stay].[Gender].[Gender].ALLMEMBERS - gender is
not displayed any more and only one row with total in it is displayed.
Why?




DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
[Clinical Performance] CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR,
FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS




Deepak Puri schrieb:

Quote:
In the report data set, are you using the OLE DB for OLAP Provider
(which should work)? I think that there may be problems with returning
the parent row, when using the Analysis Services Provider. Also, in the
report design, only the GenderName field should be used, not Gender.


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #6  
Old   
florian
 
Posts: n/a

Default Re: Total with MDX - 08-09-2006 , 09:49 AM



I use Microsoft SQL Analysis Services as a data source and as Datatype:

..Net Framework Dataprovider for Microsoft Analysis Services

for the reports


florian schrieb:

Quote:
Where can I see where which OLAP Provider I'm using?

I only used the GenderName.

My problem is that my report is a little more complex - my matrix looks
like this:


Q1 Q2 total
TownA Patients
Patient Stay

Patient Stays is simply summed up but patients is a "distinct" sum and
the total can't be calculated as a sum because I also have to keep in
mind that I need a distinct sum.

By the way when I use :

With Member [Measures].[GenderName] as
iif([Patient Stay].[Gender].CurrentMember is
[Patient Stay].[Gender].[All], "Total",
[Patient Stay].[Gender].CurrentMember.Name)
SELECT NON EMPTY {[Measures].[GenderName],
[Measures].[Patient Stay Count],
[Measures].[Length of Stay],
[Measures].[Patient Count] } ON COLUMNS,

NON EMPTY {[Patient Stay].[Gender].[Gender].ALLMEMBERS,
[Patient Stay].[Gender].[All}




---> and delete [Patient Stay].[Gender].[Gender].ALLMEMBERS - gender is
not displayed any more and only one row with total in it is displayed.
Why?




DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
[Clinical Performance] CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR,
FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS




Deepak Puri schrieb:

In the report data set, are you using the OLE DB for OLAP Provider
(which should work)? I think that there may be problems with returning
the parent row, when using the Analysis Services Provider. Also, in the
report design, only the GenderName field should be used, not Gender.


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #7  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Total with MDX - 08-09-2006 , 05:32 PM



Can you try Data Source type of "OLE DB", with OLE DB Provider selected
as "Microsoft OLE DB Provider for Analysis Services 9", and see if the
"Total" row is visible?


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #8  
Old   
florian
 
Posts: n/a

Default Re: Total with MDX - 08-10-2006 , 03:52 AM



Thanks for your great help. The "OLE DB" driver did the trick.

Cheers from Vienna Florian

Deepak Puri schrieb:

Quote:
Can you try Data Source type of "OLE DB", with OLE DB Provider selected
as "Microsoft OLE DB Provider for Analysis Services 9", and see if the
"Total" row is visible?


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.