Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Dynamic MDX for querying all the levels of Hierarchy

$
0
0
I have little experience in writing MDX query.

We have a requirement in report designer as follows

Cube created with measure (Measure1) and dimension Geography with the following hierarchy

Hierarchy is defined as Geography.Default (All City) ,Levels = Nation-->Region-->State-->City

I am using the Mondrian data source in Pentaho Report designer.

Report displayes measure1 value.

Report designer uses the Nation,Region,State and City prompts for aggregating the value of Measure1.

On selecting each prompt the value for the measure displayed in report has to change accordingly.

Simple MDX query for city will look like

SELECT
{[Measures].[Measure1]} ON COLUMNS
FROM [Cube1]
WHERE
(
strToMember(Parameter("sNation", STRING, "[Nation].[1000]")),
strToMember(Parameter("sRegion", STRING, "[Region].[200]")),
strToMember(Parameter("sState", STRING, "[State].[100]")),
strToMember(Parameter("sCity", STRING, "[City].[10]"))
)

Is it possible to write a dynamic MDX query on top of this cube to fetch the value of Measure1 based on the prompt selection?

Eg:
Case 1: The below prompt selection should display Measure 1 value of all the Regions under Nation 1001
Nation --1001
Region -- All region
State --All State
City -- All City

Case 2: The below prompt selection should display Measure 1 value of all the states under Region 202
When the propmt value is:
Nation --1001
Region -- 202
State --All State
City -- All City


Case 3: The below prompt selection should display Measure 1 value of all the states under cities under state 102
When the propmt value is:
Nation --1001
Region -- 202
State --102
City -- All City

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>