Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 mdx having clause

Author  Topic 

sgandhi
Posting Yak Master

115 Posts

Posted - 2009-08-27 : 09:51:04
Hi, i have the following MDX query.

SELECT NON EMPTY { [Measures].[Count_Content Type Key], [Measures].[Shop Cart Abandoned], [Measures].[Sum_Content Type Key] } ON COLUMNS, NON EMPTY { ([Time].[By Date].[The Date].ALLMEMBERS * [Content Type].[Content Type Id].[Content Type Id].ALLMEMBERS * [User Session].[By Company].[User Session].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM [B2R Analytics]
CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS


I want to filter the results by saying something like,
[Measures].[Count_Content Type Key], =1 and [Measures].[Sum_Content Type Key] !=16

But if i put it in the filter it doesnt work. Can i put it in the query somehow?


I wrote the following query against the fact table and that returns the results i want, but i dont know how to rewrite this in MDX

select time_by_day_key,session_key,shop_cart_abandoned,
COUNT(content_type_key) as count,sum(content_type_key) as sum
from fact.session_statistics
WHERE (content_type_key in (6) or content_type_key in (16) )
and time_by_day_key = '20090710'
group by time_by_day_key,session_key, shop_cart_abandoned
having count(content_type_key) =1 and sum(content_type_key) !=16
order by 2


Can someone help me out with this

Thanks

   

- Advertisement -