Quantcast
Channel: SQL Server Analysis Services Forum
Viewing all articles
Browse latest Browse all 2472

Getting TOP N customers based on their address or the address of the store....

$
0
0

I have a simple transactions cube... with a Customers dimension, Store dimension and a tickets measure table. I would like to provide the Top(N) Customers based on the city state they live in or the city state they purchased in for a given period. So for example I would like to know the TOP 10 Customers based on their Ticket Count (The number of sales transactions) for Dallas Texas in February 2013. These Customers could either live in Dallas Texas or have made purchases with Stores in Dallas Texas. My Customer and Store dimensions both of location Hierachies. But I can't seem to figure out how to produce this result. Everything I have tried returns either dimensionality errors or a list of customers who both live and have purchased in Dallas Texas.

To help clarify in TSQL I might write:

Select  TOP 10

CustomerId,CustomerName,Count(*)

from Tickets t

left outer join Customers c on t.CustomerId=c.CustomerId

left outer join Stores s on t.StoreId=s.StoreId

where (c.City='Dallas' and c.State='Texas') or (s.City='Dallas' and s.State='Texas')

Group by CustomerId,CustomerName

order by Count(*) desc

Any Help would be greatly appreciated.

David



Viewing all articles
Browse latest Browse all 2472

Latest Images

Trending Articles



Latest Images

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