开发者

MDX Query to return list of customers except customers from previous time periods

开发者 https://www.devze.com 2023-04-12 14:46 出处:网络
I have a trouble writing 2 MDX queries: 1) A query that should return all customers (with corresponding sales amount), which have made a purchase in the last 3 finished months (at least 1 purchase in

I have a trouble writing 2 MDX queries:

1) A query that should return all customers (with corresponding sales amount), which have made a purchase in the last 3 finished months (at least 1 purchase in each month), and didn't make any purchase in the months before those 3 months (the starting period is the beginning of the current year)

2) A query that should return all customers (with corresponding sales amount), which have NOT made a purchase in the last 3 finished months (no purchase in each month), but made any purchase in the m开发者_Python百科onths before those 3 months (the starting period is the beginning of the current year)

The structure of underlying DWH for the OLAP cube is following:

There is one fact table called factPurchases (containing the salesAmount column, which is also a measure in the cube), and these dimension tables: dimCustomer, and dimDate (with hierarchy levels Year, Month, Day).

I've stuck at the point, how to filter out the "not-wanted" customers out of the results. Can anybody help me, please?


What about the Except function? Is it not working?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号