English 中文(简体)
MDX result categorisation
原标题:

I m new to mdx and have been trying to solve the following problem for about a day now. Any help would be appreciated:

My Query:

select {[Measures].[Kunden]} ON COLUMNS,
NON EMPTY Hierarchize(Union({CurrentDateMember([dimZeit], "[dimZeit] 
.[yyyy]"), CurrentDateMember([dimZeit], "[dimZeit].[yyyy]").Children}, 
CurrentDateMember([dimZeit], "[dimZeit].[yyyy].[q]").Children))) ON ROWS
FROM Center

which gives the following result, as expected:

Zeit        Kunden
2010        1561
 - Q1       523
 - Q2       470
 - Q3       256
 - Q4       312
  - Nov.    312

Now, what I want to achieve is to split the column Kunden into columns Kunden < 5 min and Kunden > 5min which means customers who have waited for less or more than 5 minutes.

The closest I could get was the following:

WITH 
MEMBER [Measures].[LT5] AS 
Aggregate(
Filter([Measures].[Kunden], [Measures].[Wartezeit] < 3000))
select {[Measures].[LT5]} ON COLUMNS,
NON EMPTY Hierarchize(Union({CurrentDateMember([dimZeit], "[dimZeit].[yyyy]"), 
CurrentDateMember([dimZeit], "[dimZeit].[yyyy]").Children}, 
CurrentDateMember([dimZeit], "[dimZeit].[yyyy].[q]").Children)) ON ROWS
FROM Center

The result is:

Zeit        Kunden
2010        -
 - Q1       75
 - Q2       23
 - Q3       86
 - Q4       71
  - Nov.    71

I understand the cause for this is, because the aggregated [Measure].[Wartezeit] for the whole year 2010 is above 3000 seconds. But I d like to see the amount of customers with a waiting time below 3000 seconds, so it should be 75+23+86+71 = 255 for 2010.

问题回答

Solved it by creating a degenerated dimension on the wartezeit column that looks like this in mondrian:

<Dimension name="dauer">
  <Hierarchy hasAll="true">
    <Level name="dauer" column="dauer" uniqueMembers="true">
      <KeyExpression>
        <SQL dialect="generic"> 
           <![CDATA[(case when dauer < 300 then  LT5  
                          when dauer < 600 then  LT10 
                          else  GT60 
                     end)]]></SQL>
      </KeyExpression>
    </Level>
  </Hierarchy>
</Dimension>

The select clause of my query is now a simple crossjoin:

({[Measures].[Kunden]} * {[dauer].[LT5], [dauer].[LT10], [dauer].[GT60]}) 




相关问题
When is data erased from the OLAP DB?

I am new to OLAP. I understand the table structure and ETL process. I don t understand when data is supposed to be deleted from the fact table. Say I m creating a reporting application for events. ...

IIS 6.0 Application Pool Identity Being Ignored

I am using IIS 6.0 on Windows 2003 in a workgroup, and have created a web which runs in its own pool to connect to a Sqlserver 2005 Analysis Services database using msmdpump.dll. I have set the pool ...

Any scalable OLAP database (web app scale)?

I have an application that requires analytics for different level of aggregation, and that s the OLAP workload. I want to update my database pretty frequently as well. e.g., here is what my update ...

MDX Calculated Member CrossJoin question

I have an MDX query with the following calculated member: with member [Measures].[BBOX] as Count( Filter( CrossJoin([Dim Response].[Response ID].Children, [Dim Question].[Question Text]....

trouble connecting Excel to Analysis Services server

We have an SSAS server with a cube deployed on a server over the WAN.. We are trying to connect to the cube from Excel on various client workstations. The server is not on a domain with the clients. ...

Cant connect to analysis services via excel

I have an analysis services cube in SQL server 2005 which I m connecting to via an excel front end. When I connect via one user its fine, but when I log on to the same machine as another user I get ...

Dimension Security in OLAP Cubes

I have defined dimension security in my OLAP cube by creating roles and assigning users to each roles. Each user in a role can only see the location they belong to. When I browse the cube using a ...

热门标签