MDX Query Help -
02-08-2006
, 07:12 AM
MDX Query Help
I'm new to MDX and apparently still thinking with an SQL mind.
Is there a synonymous technique to correlated sub querying in MDX?
I've populated a test click stream cube ( Pseudo Schema at end of message-
other dimensions excluded for clarity-)
The question I'm trying to answer with the query is
What are the stats(agg sum) of the second clicks in the stream where the
first click is the home page (Id 184)
In the relational world I'd do something like this - SQL Query 1 - (at end
of message).
and the next step would be, of those give me click 3 - Sql Query 2 -.
I can put -MDX Query 1- in a pivot table (OWC), but it just gives me all the
totals
how can I restrict to show click2 only when click1 is a certain value.
Any help would be greatly appricated. I'm sure this must be possible in MDX.
Or is there a better cube schema that would give me this information.
Thanks
--------
Sql Query 1
---------
select EventKey,count(EventKey) from EventFact Fact1
Where EventSequenceKey = 2
and exists
( Select 1 from EventFact Fact2
where
EventSequenceKey = 1 and
EventKey = 184 and
EventSessionKey = Fact1.EventSessionKey
)
group by EventKey
order by count(EventKey) desc
---------
---------
SQL Query 2
---------
select EventKey,count(EventKey) from EventFact Fact1
Where EventSequenceKey = 3
and exists
( Select 1 from EventFact Fact2
where
EventSequenceKey = 2 and
EventKey = 773 and
EventSessionKey = Fact1.EventSessionKey
And Exists
( Select 1 from EventFact Fact3
where
Fact3.EventSequenceKey = 1 and
Fact3.EventKey = 184 and
Fact3.EventSessionKey = Fact2.EventSessionKey
)
)
group by EventKey
order by count(EventKey) desc
---------
MDX Query 1
---------
SELECT NON EMPTY {[EventSequence].[All EventSequence] ,
AddCalculatedMembers([EventSequence].[Sequence Name].MEMBERS)}
DIMENSION PROPERTIES MEMBER_NAME, PARENT_UNIQUE_NAME ON COLUMNS,
NON EMPTY {[EventPage].[All EventPage] ,
AddCalculatedMembers([EventPage].[Event Name].MEMBERS)}
DIMENSION PROPERTIES MEMBER_NAME, PARENT_UNIQUE_NAME ON ROWS,
{
[Measures].[Event Fact Id]
}
ON PAGES
FROM [EventClick]
---------
CUBE PSEDUO SCHEMA
Fact Table (EventFact)
---------------------
RowId
EventKey - ie Site Page Key
EventSequenceKey - ie Order of this Click
EventSessionKey - ie UsersSession
DateKey - Standard Date Dimension Key
TimeKey - Standard Time Dimension Key
Event Table
---------------------
EventKey - ie Id
EventName - ie Page Name
etc...
EventSequence Table
---------------------
EventSequenceKey - ie Id
SequenceName - ie Click1 Click2 etc...
EventSequence - ie 1,2,3,4,etc...
etc...
EventSessionKey Table
---------------------
EventSessionKey - ie. Id
EventSessionId = ie. AspSessionId from logs |