Solved

How to sum over time period in MDX

Posted on 2008-10-29
3
2,836 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how the fundamental information of how to create a table.

690 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