dbTalk Databases Forums  

Granularity issues!

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Granularity issues! in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
grahamrichter@gmail.com
 
Posts: n/a

Default Granularity issues! - 09-19-2005 , 09:32 AM






I have a simple cube, with a single dimension and a fact table. It
measures Number of sales, and the only dimension is Location with
levels State, City and Branch.

On my report I need to report on market penetration, i.e. Sales per
Population. Now the sales are stored in the Fact table, at the Branch
level. I have the population on a City level, not on a Branch level. In
other words my Population's granularity is one level higher than my
Sales measure, yet I need to divide the one by the other at a City or
State level to get the ratio.

The question is: Where do I store the Population of a city? Is it in
the Fact table? Or is it a member property of the City dimension? How
can I divide Sales by Population in a MDX query?

Much appreciated!


Reply With Quote
  #2  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: Granularity issues! - 09-20-2005 , 07:57 AM






In AS2k what you would need to do is to create one cube that contains
the facts at the city granularity and another that has the sales facts
and then join them via a virtual cube. I am guessing that these 2 cubes
would have the same dimensions. In the cube with the population figures
you would disable the levels below "city".

You will then be able to create a calculated measure in the virtual cube
for the sales per population.

For more information on different data granularity have a look at the
following article from Microsoft
http://go.microsoft.com/fwlink/?linkid=23157

I was written for OLAP Services (SQL7), but still applies to AS2k. But
it will all change in AS'05 with the advent of the UDM and measure
groups.

--
Regards
Darren Gosbell [MCSD]
<dgosbell_at_yahoo_dot_com>
Blog: http://www.geekswithblogs.net/darrengosbell

In article <1127140353.767793.11840 (AT) g44g2000cwa (DOT) googlegroups.com>,
grahamrichter (AT) gmail (DOT) com says...
Quote:
I have a simple cube, with a single dimension and a fact table. It
measures Number of sales, and the only dimension is Location with
levels State, City and Branch.

On my report I need to report on market penetration, i.e. Sales per
Population. Now the sales are stored in the Fact table, at the Branch
level. I have the population on a City level, not on a Branch level. In
other words my Population's granularity is one level higher than my
Sales measure, yet I need to divide the one by the other at a City or
State level to get the ratio.

The question is: Where do I store the Population of a city? Is it in
the Fact table? Or is it a member property of the City dimension? How
can I divide Sales by Population in a MDX query?

Much appreciated!



Reply With Quote
  #3  
Old   
SQL McOLAP
 
Posts: n/a

Default RE: Granularity issues! - 09-20-2005 , 11:37 AM



If you only need to see this ratio at the city level, there is a way you
could do it with the population stored in your city level table (if it's
snowflaked) or in your city level column (repateated for each city if in
star) while still using just one cube.

You can create a calculated member that evaluates which level you're on in
your axis, and if in city, it grabs the population. Then another that will
divide by the city member property storing your population.

Something like:

--create a measure calc member for the population
With member [measures].[population] as
'IIF([location].currentmember.level.ordinal = [location].[city].level.ordinal,
[location].currentmember.properties("Population"),0)'

--create a measure calc member that then does the division
member [measures].[sales ratio] as
'IIF([measures].[population] <> 0,
[measures].[sales]/[measures].[population],0)', solve_order = 10

select { [measures].[sales ratio] } on columns,
{ [location].[city].members } on rows
from [cubename]


Those calculated members could be combined, I figured seperating them like
that would make this easier to understand.

However, if you need to do other evaluations at other levels, or need
population to aggregate up a hierarchy, follow Darren's excellent suggestion
with another cube joined up into a virtual. The article he provides a link
to is very helpful.

Good luck.

- Phil


"grahamrichter (AT) gmail (DOT) com" wrote:

Quote:
I have a simple cube, with a single dimension and a fact table. It
measures Number of sales, and the only dimension is Location with
levels State, City and Branch.

On my report I need to report on market penetration, i.e. Sales per
Population. Now the sales are stored in the Fact table, at the Branch
level. I have the population on a City level, not on a Branch level. In
other words my Population's granularity is one level higher than my
Sales measure, yet I need to divide the one by the other at a City or
State level to get the ratio.

The question is: Where do I store the Population of a city? Is it in
the Fact table? Or is it a member property of the City dimension? How
can I divide Sales by Population in a MDX query?

Much appreciated!



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.