Solved

How to sum over time period in MDX

Posted on 2008-10-29
3
2,816 Views
Last Modified: 2013-11-16
I got time dimension based on DateTime column in fact table. Now i'am trying to build MDX query to sum fact rows on custom time periods. For example:

SELECT [Events Count] ON Columns, [20 seconds time periods] on Rows FROM [Common]

Result i expect:

                                             Events Count
2008-10-29 17:22:00                     1
2008-10-29 17:22:20                     2
2008-10-29 17:22:40                     1
2008-10-29 17:23:00                     56

How to build MDX query?
regards
Kuba F.
0
Comment
Question by:kubaf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Expert Comment

by:srnar
ID: 22838829
Use a new dimension with 60 members - one for each second. Map this dimension to your fact table. Then you can construct 3 custom sets e.g. {Second.[0]:Second.[19]}, {Second.[20]:Second.[39]}, {Second.[40]:Second.[59]} and put them on the row axes.
0
 

Author Comment

by:kubaf
ID: 22838856
srnar can you write sample MDX with sets? I'am kinda new in analysis services.
0
 
LVL 8

Accepted Solution

by:
srnar earned 500 total points
ID: 22838925
Here is example on Adventure works that creates virtal members based on sets and puts them on the rows.
with set Decade01Set
as
	{[Date].[Fiscal].[Date].[July 1, 2001]:[Date].[Fiscal].[Date].[July 10, 2001]}
set Decade02Set
as
	{[Date].[Fiscal].[Date].[July 11, 2001]:[Date].[Fiscal].[Date].[July 20, 2001]}	
member [Date].Fiscal.Decade01
as
	aggregate(Decade01Set)
member [Date].Fiscal.Decade02
as
	aggregate(Decade02Set)
select Measures.Defaultmember on columns,
{[Date].Fiscal.Decade01, [Date].Fiscal.Decade02} on rows
from [Adventure Works];

Open in new window

0

Featured Post

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question