dbTalk Databases Forums  

Average Daily Calls in a month

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


Discuss Average Daily Calls in a month in the microsoft.public.sqlserver.olap forum.



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

Default Average Daily Calls in a month - 03-07-2006 , 12:14 PM






I have a MDX query

WITH
MEMBER [Measures].[Calls] AS
''[Measures].[Acdcalls]+[Measures].[connectcalls]''
SET [YearRange] AS
''({[YearMonthDay].[Year].[2006],[YearMonthDay].[Year].[2005]})''
SELECT {[Month].children} ON ROWS,
{[YearRange]} ON COLUMNS
FROM [HVDNCube]

The output is as follows

Months Year.2006 Year.2005
__________________________
Jan 62 15
Feb 56 93
....
....


Now I want to calculate the Average Daily calls

The output should be

Months Year.2006 Year.2005
__________________________
Jan 2 (62/31) ...
Feb 2(56/28) ...
....
....

Any help would be appreciated

Milind


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

Default Re: Average Daily Calls in a month - 03-08-2006 , 07:09 PM






This would be cleaner in AS 2005, with [Month] and [YearMonthDay] as
hierarchies of the same Time dimension. But if you're using AS 2000, try
something like:

Quote:
WITH
MEMBER [Measures].[Calls] AS
'[Measures].[Acdcalls]+[Measures].[connectcalls]'
Member [Measures].[DayCount] as
'NonEmptyCrossJoin(Descendants([YearMonthDay].CurrentMember,
[YearMonthDay].[Day]), {[Month].CurrentMember}).Count'
Member [Measures].[AvgDailyCalls] as
'CInt([Measures].[Calls]/[Measures].[DayCount])'
SET [YearRange] AS
'({[YearMonthDay].[Year].[2006],
[YearMonthDay].[Year].[2005]})'
SELECT {[Month].children} ON ROWS,
{[YearRange]} ON COLUMNS
FROM [HVDNCube]
Where ([Measures].[AvgDailyCalls])
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


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

Default Re: Average Daily Calls in a month - 03-09-2006 , 02:54 AM



It works! I dont have to use temporary tables now.

Thanks Deepak!


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.