dbTalk Databases Forums  

Frequency

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


Discuss Frequency in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Terence
 
Posts: n/a

Default Frequency - 11-06-2003 , 03:14 PM






How are you?

If a store sold an item or more, I would like that cell to
be 1. I can do this with the following MDX.

IIF([Measures].[Quantity]>0,1,NULL)

The problem with this is that it will not aggregate up the
hierarchy. Does anybody know how to do this?

Thanks for your interest and help.
Terence
tclauer (AT) badcock (DOT) com


Reply With Quote
  #2  
Old   
Brian Altmann
 
Posts: n/a

Default Frequency - 11-06-2003 , 03:34 PM






If you mean you want to aggregate the number of stores
that sold items, then this query (you can run it in
Foodmart) might help:

with member measures.items as 'sum(descendants
(store.currentmember,[store name]),iif( [Unit Sales]
Quote:
0,1,0))'
select
{ items } on columns,
descendants(store.usa,[store name],self_and_before) on
rows
from sales

HTH,
Brian
www.geocities.com/brianaltmann/olap.html





Quote:
-----Original Message-----
How are you?

If a store sold an item or more, I would like that cell
to
be 1. I can do this with the following MDX.

IIF([Measures].[Quantity]>0,1,NULL)

The problem with this is that it will not aggregate up
the
hierarchy. Does anybody know how to do this?

Thanks for your interest and help.
Terence
tclauer (AT) badcock (DOT) com

.


Reply With Quote
  #3  
Old   
T Clauer
 
Posts: n/a

Default Re: Frequency - 11-06-2003 , 04:50 PM



Brian,
I copied and pasted your example MDX in to Foodmart. It wouldn't pass
the MDX test.

What I am trying to say is, if a store sold a specfic item one or more
times, than I want it to show "1". If it didn't sale this item, than
NULL. I can get it to do this with the MDX:

IIF([Measures].[Quantity]>0,1,NULL)

So if I drill down on STORES some will have a 1 and others will be
blank. But if I just click on STORES, it still says 1. STORES is the
top and needs to sum all the stores below it that have a 1.

Can you assist.

Thanks a mil.

TC at WSB

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #4  
Old   
Tim Harris
 
Posts: n/a

Default Re: Frequency - 11-07-2003 , 04:18 PM



Sorry I didn't convert this to FoodMart, hopefully this can still help.
There might be simpler 1 step approaches, but here is what I did to get
store counts for Stores with Sales.

First I created a new calculated measure named "Sales U GT 0" to test
whether sales were greater than zero:
[Measures].[Sales Units Tot]>0
This returns a 1 if true and a zero if false. Then I changed the visible
property to FALSE so the users don't see it.

Next I created another calculated member named "Store Count (Sls)" (we have
another one for Inventory):
SUM(
Descendants(
[Locations].CurrentMember,[Locations].[Store]),
[Measures].[Sales U GT 0])

"T Clauer" <tclauer (AT) badcock (DOT) com> wrote

Quote:
Brian,
I copied and pasted your example MDX in to Foodmart. It wouldn't pass
the MDX test.

What I am trying to say is, if a store sold a specfic item one or more
times, than I want it to show "1". If it didn't sale this item, than
NULL. I can get it to do this with the MDX:

IIF([Measures].[Quantity]>0,1,NULL)

So if I drill down on STORES some will have a 1 and others will be
blank. But if I just click on STORES, it still says 1. STORES is the
top and needs to sum all the stores below it that have a 1.

Can you assist.

Thanks a mil.

TC at WSB

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply With Quote
  #5  
Old   
 
Posts: n/a

Default Re: Frequency - 12-04-2003 , 01:13 PM



This is how I did it.

FREQUENCY STORE SALES

IIF(SUM(DESCENDANTS([Organization].[Org Type].
[Store],1,SELF),
[Measures].[Total Qty Sold]>.999)=0,NULL,SUM(DESCENDANTS
([Organization].[Org Type].[Store],
1,SELF),[Measures].[Total Qty Sold]>.999))

FREQUENCY STORE INVENTORY

IIF(SUM(DESCENDANTS([Organization].[Org Type].
[Store],1,SELF),
[Measures].[On Hand Quantity]>.999)=0,NULL,SUM(DESCENDANTS
([Organization].[Org Type].[Store],
1,SELF),[Measures].[On Hand Quantity]>.999))

Thanks for everybody's input.

TC




Quote:
-----Original Message-----
Sorry I didn't convert this to FoodMart, hopefully this
can still help.
There might be simpler 1 step approaches, but here is
what I did to get
store counts for Stores with Sales.

First I created a new calculated measure named "Sales U
GT 0" to test
whether sales were greater than zero:
[Measures].[Sales Units Tot]>0
This returns a 1 if true and a zero if false. Then I
changed the visible
property to FALSE so the users don't see it.

Next I created another calculated member named "Store
Count (Sls)" (we have
another one for Inventory):
SUM(
Descendants(
[Locations].CurrentMember,[Locations].[Store]),
[Measures].[Sales U GT 0])

"T Clauer" <tclauer (AT) badcock (DOT) com> wrote in message
news:OLI9IALpDHA.424 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Brian,
I copied and pasted your example MDX in to Foodmart.
It wouldn't pass
the MDX test.

What I am trying to say is, if a store sold a specfic
item one or more
times, than I want it to show "1". If it didn't sale
this item, than
NULL. I can get it to do this with the MDX:

IIF([Measures].[Quantity]>0,1,NULL)

So if I drill down on STORES some will have a 1 and
others will be
blank. But if I just click on STORES, it still says
1. STORES is the
top and needs to sum all the stores below it that have
a 1.

Can you assist.

Thanks a mil.

TC at WSB

*** Sent via Developersdex http://www.developersdex.com
***
Don't just participate in USENET...get rewarded for it!


.


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.