dbTalk Databases Forums  

"group by" between two dates

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


Discuss "group by" between two dates in the microsoft.public.sqlserver.olap forum.



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

Default "group by" between two dates - 03-11-2005 , 09:18 AM






Anybody know how to get this to work in MDX ?

I have the following dimensions (and a fact)

Service
id Name
1 /channels/generic/3gcover.jsp
2 /channels/vconnect/index.jsp
3 /channels/vconnect/manual/index.jsp
4 /channels/vconnect/services/logon.jsp

Time
id Year Month Day Hour Min
1 2004 10 11 5 21
2 2004 10 11 5 22
3 2004 10 11 5 23
4 2004 10 11 5 24
5 2004 10 11 5 25
6 2004 10 11 5 26
7 2004 10 11 6 1
8 2004 10 11 6 2
9 2004 10 11 6 3

Fact
Time_id Service_id #Requests
1 1 12
1 2 25
1 3 145
1 4 35
2 2 9
2 3 15
2 4 67
3 1 20
4 2 45
4 3 90
4 4 76
5 1 85
5 2 16
6 1 89
7 1 76
8 1 12
9 1 15
9 2 45
9 3 21
9 4 49

I want to a list of services, and the #Requests made for each service
between 2004-10-11 5:23 AND 2004 -10-11 06:01

The data should look like this at the end

Service Name, #Requests
/channels/generic/3gcover.jsp 270
/channels/vconnect/index.jsp 61
/channels/vconnect/manual/index.jsp 90
/channels/vconnect/services/logon.jsp 76


Thanks




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

Default Re: "group by" between two dates - 03-11-2005 , 12:33 PM






Assuming a [ServiceRequest] cube, with Service and Time (Y/Mo/D/H/Mi)
dimensions and [#Requests] 'sum' measure:

Quote:
With Set [TimeRange] as
'{[Time].[2004-10-11 5:23]:[Time].[2004-10-11 06:01]}'
Member [Time].[TimeAgg] as 'Aggregate([TimeRange])'

Select {[#Requests]} on columns,
Non Empty [Service].[ServiceID].Members on rows
from [ServiceRequest]
where ([Time].[TimeAgg])
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


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.