Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDX get last 24 hours period, URGEN HELP!!!!!!

Status
Not open for further replies.

wheresaldo

Programmer
Sep 9, 2003
2
US
Hi,

I have a cube with a time dimension with a Date field and an Hour field. Using MDX, I need to retreive the last 24 hours, starting from the latest hour in the cube. For example: I need to get the last 24 hours from 3-7-08 date hour 12. This means that I need to get hours 13 to 23 from date 3-6-08 and hour 0 to 12 from date 3-7-08. I already get the start date and hour and the end date and hour outside MDX via C# code, but I don't know how to write the MDX that will give me both ranges, 13 to 23 from date 3-6-08 and 0 to 12 from date 3-7-08, together.

What I need to do is something like this:

SELECT NON EMPTY { [Measures].[x] } ON COLUMNS
FROM [xyz]
WHERE ( [xyz Time].[Date].&[2008-03-06T00:00:00], [xyz Time].[Hour].&[13]:[xyz Time].[Hour].&[23])


and join with this:


SELECT NON EMPTY { [Measures].[x] } ON COLUMNS
FROM [xyz]
WHERE ( [xyz Time].[Date].&[2008-03-07T00:00:00], [xyz Time].[Hour].&[0]:[xyz Time].[Hour].&[12])


How do we do this in a single MDX statement?

A

 
I've got a similar problem (I think) with multiple elements in the WHERE clause. Here's my problem:

Code:
select 
  NON EMPTY {[Measures].[Total Value], [Measures].[Quantity]} ON COLUMNS,
  NON EMPTY Hierarchize(Union({[CustomerProduct].[All CustomerProducts]}, [CustomerProduct].[All CustomerProducts].Children)) ON ROWS
from [MyCube]
where (
  [AccountManager].[All AccountManagers].[Barney], 
  [AccountManager].[All AccountManagers].[Fred], 
  [Time].[All Times].[FY2008]
)

This doesnt work, I can use Fred or Barney, but not both.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top