Quantcast
Channel: SQLServerCentral » Data Warehousing » Analysis Services » Latest topics
Viewing all articles
Browse latest Browse all 1341

MDX Query Roll-Up

$
0
0
Can I add a roll-up aggregete in MDX query (not the customized roll-up in cube design).For example, using Adventure Works DW 2008R2 database, I ran the following queryselect [Measures].[Internet Sales Amount] on columns,[Product].[Product Line].Children on rowsfrom [Adventure Works]and have the result // Internet Sales Amount//Accessory $604,053.30//Components (null)//Mountain $10,251,183.52//Road $14,624,108.58//Touring $3,879,331.82I want to roll up the numbers to Accessory and NonAccessory. The only way I have is:With MEMBER Measures.Accessory ASsum([Product].[Product Line].&[S], [Measures].[Internet Sales Amount])Member Measures.NonAccessory ASsum(Except([Product].[Product Line].Children, [Product].[Product Line].&[S]), [Measures].[Internet Sales Amount])select {[Measures].[Internet Sales Amount], Measures.Accessory, Measures.NonAccessory} on columnsfrom [Adventure Works]and the result is //Internet Sales Amount Accessory NonAccessory//$29,358,677.22 $604,053.30 $28,754,623.92Is it possible to have a result like// MainProductLine Internet Sales Amount//Accessory Accessory $604,053.30//Components NonAccessory (null)//Mountain NonAccessory $10,251,183.52//Road NonAccessory $14,624,108.58//Touring NonAccessory $3,879,331.82In other words, is it possible to add a rollup on the fly without changing the cube design?

Viewing all articles
Browse latest Browse all 1341

Trending Articles