Re: TOPCOUNT giving different results
- From: "amish" <shahamishm@xxxxxxxxx>
- Date: 27 Feb 2007 06:30:29 -0800
On Feb 27, 4:04 pm, "Gautham Kamath via SQLMonster.com" <u9571@uwe>
wrote:
The following are the three queries and their respective results that I tried
Against Adventure Works cube in Adventure Works DW SSAS database
Query 1:
Select [Measures].[Internet Sales Amount] on 0,
TOPCOUNT([Product].[Product Categories].[SubCategory].Members, 5,
([Customer].[Customer Geography].[Country].&[United States],[Measures].
[Internet Sales Amount])) on 1
from [Adventure Works]
Query 1 Results:
Internet Sales Amount
Road Bikes - $14,520,584.04
Mountain Bikes - $9,952,759.56
Touring Bikes - $3,844,801.05
Tires and Tubes - $245,529.32
Helmets - $225,335.60
Query 2:
Select [Measures].[Internet Sales Amount] on 0,
TOPCOUNT([Product].[Product Categories].[SubCategory].Members, 5, [Measures].
[Internet Sales Amount]) on 1
from [Adventure Works]
WHERE [Customer].[Customer Geography].[Country].&[United States]
Query 2 Results:
Internet Sales Amount
Road Bikes - $4,289,925.90
Mountain Bikes - $3,417,457.74
Touring Bikes - $1,292,475.90
Tires and Tubes - $88,769.73
Helmets - $76,768.06
Query 3:
Select ([Measures].[Internet Sales Amount], [Customer].[Customer Geography].
[Country].&[United States]) on 0,
TOPCOUNT([Product].[Product Categories].[SubCategory].Members, 5,
([Customer].[Customer Geography].[Country].&[United States],[Measures].
[Internet Sales Amount])) on 1
from [Adventure Works]
Query 3 Results:
Internet Sales Amount
Road Bikes - $4,289,925.90
Mountain Bikes - $3,417,457.74
Touring Bikes - $1,292,475.90
Tires and Tubes - $88,769.73
Helmets - $76,768.06
Query 2 and Query 3 return the correct results that I want (Top 5 Internet
Sales Amount for [Product SubCategory members in US) .
But Query 1 gets me the top 5 total of [Product].[Product Categories].
[SubCategory].Members despite the presence of the tuple ([Customer].[Customer
Geography].[Country].&[United States],[Measures].[Internet Sales Amount]).
Why is this happening? Any help is appreciated.
--
Message posted viahttp://www.sqlmonster.com
Your query gets top 5 products of United States and gives total sales
of that 5 Product.
Change it to
Select [Measures].[Internet Sales Amount] on 0,
TOPCOUNT([Product].[Product Categories].[SubCategory].Members, 5,
([Customer].[Customer Geography].[Country].&[United
States],[Measures].
[Internet Sales Amount])) on 1
from [Adventure Works]
where [Customer].[Customer Geography].[Country].&[United States]
Thanks and Regards
Amish Shah
http:\\shahamishm.tripod.com
.
- References:
- TOPCOUNT giving different results
- From: Gautham Kamath via SQLMonster.com
- TOPCOUNT giving different results
- Prev by Date: Error processing a dimension (two tables hierarchy)
- Next by Date: Re: Format Semester, Quarter,etc.. in Time Dimension
- Previous by thread: TOPCOUNT giving different results
- Next by thread: SUBCUBE issue
- Index(es):
Relevant Pages
|