dbTalk Databases Forums  

MDX for calculating visited stores

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


Discuss MDX for calculating visited stores in the microsoft.public.sqlserver.olap forum.



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

Default MDX for calculating visited stores - 12-13-2004 , 07:32 AM






Hi,

I have Store, Visit and Time(Year, Month, Day) dimensions and VisitResult
measure in my Cube - to simplify things.
Stores can be visited 0, 1 or many times per month.

I need to write MDX query that returns number of different Stores visited in
one year, that have been visited at least once each month.
And it shoud be done by months, so for January it's only count of distinct
Stores that have been visited, that's no problem.
Then for February it is count of distinct stores that have been visited both
in January and February. For March it is count
of distinct Stores visited at least once in January and February and March.
And so on to December which is count of distinct Stores
visited in one year, that have been visited at least once each month.



Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: MDX for calculating visited stores - 12-13-2004 , 01:40 PM






Does the "Visits" dimension track individual visit events as members -
its role is not clear from the description?


- Deepak

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

Reply With Quote
  #3  
Old   
Jéjé
 
Posts: n/a

Default Re: MDX for calculating visited stores - 12-13-2004 , 07:53 PM



maybe a formula like this: (not tested)

count(filter(stores.storelevel.members, measures.visits =12))

this can works if you have only 2 dimensions (time and store)
if you want to count the number of months with at least 1 visit then a
formula like this:

sum(stores.storelevel.members,
iif(12=count(filter(time.month.members, measures.visits>0)), 1,0)

for each store, the number of months with visits = 12 count it.

read this excellent article:
http://msdn.microsoft.com/library/de...l/semiadd2.asp
"Analysis Services: DISTINCT COUNT, Basket Analysis, and Solving the
Multiple Selection of Members Problem"

"Bender" <roman.ilic (AT) avtenta (DOT) si> a écrit dans le message de news:
u3zWwgR4EHA.3908 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Quote:
Hi,

I have Store, Visit and Time(Year, Month, Day) dimensions and VisitResult
measure in my Cube - to simplify things.
Stores can be visited 0, 1 or many times per month.

I need to write MDX query that returns number of different Stores visited
in
one year, that have been visited at least once each month.
And it shoud be done by months, so for January it's only count of distinct
Stores that have been visited, that's no problem.
Then for February it is count of distinct stores that have been visited
both
in January and February. For March it is count
of distinct Stores visited at least once in January and February and
March.
And so on to December which is count of distinct Stores
visited in one year, that have been visited at least once each month.





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.