Showing posts with label returning. Show all posts
Showing posts with label returning. Show all posts

Tuesday, March 20, 2012

Report Builder MDX on filter

Please interpret this MDX statement generated by Report Builder for me. I am not sure why it is returning all years in cube when I just want 2005:

SELECT

{ ( Extract( filter( { [Accounting Date].[MDY Date].Levels(1).Members * { [Accounting Date].[Date].[Calendar] } }, ( ( [Accounting Date].[MDY Date].CurrentMember.membervalue >= "09/01/2005" ) AND ( [Accounting Date].[MDY Date].CurrentMember.membervalue <= "09/30/2005" ) ) ), [Accounting Date].[MDY Date] ) , * ) } on 0

FROM

[Cube]

It is filtering the data on the month and day portion of the date range just fine, just not filtering on the year. Same report in Reporting Services generates different MDX and returns 2005 only, so this rules out cube problem.

Could you please add CDate() around the begin and end dates, so as comparisons are made using the proper time ordering?

For instance:

... >= CDate("09/01/2005") ...

Report Builder mdx filter returns too many rows

I captured this mdx statement issued by Report Builder in SQL Profiler to
figure out why it was returning more than one year:
(SELECT
{ ( Extract( filter( { [Accounting Date].[MDY Date].Levels(1).Members * {
[Accounting Date].[Date].[Calendar] } },
( ( [Accounting Date].[MDY Date].CurrentMember.membervalue >= "09/01/2005" )
AND ( [Accounting Date].[MDY Date].CurrentMember.membervalue <= "09/30/2005" ) ) ),
[Accounting Date].[MDY Date] ) , * ) } on 0
FROM
[cube]
I just want September 2005 data, but it is returning September data for all
years in the cube.same filter in select statement rendered in Reporting Services Wizard:
FROM ( SELECT ( STRTOMEMBER(@.FromAccountingDateMDYDate, CONSTRAINED) :
STRTOMEMBER(@.ToAccountingDateMDYDate, CONSTRAINED) ) ON COLUMNS FROM [cube])
This works, just can't save report due to known bug using wizard against
Analysis Services 2005.
"bhorwatt" wrote:
> I captured this mdx statement issued by Report Builder in SQL Profiler to
> figure out why it was returning more than one year:
> (SELECT
> { ( Extract( filter( { [Accounting Date].[MDY Date].Levels(1).Members * {
> [Accounting Date].[Date].[Calendar] } },
> ( ( [Accounting Date].[MDY Date].CurrentMember.membervalue >= "09/01/2005" )
> AND ( [Accounting Date].[MDY Date].CurrentMember.membervalue <=> "09/30/2005" ) ) ),
> [Accounting Date].[MDY Date] ) , * ) } on 0
> FROM
> [cube]
> I just want September 2005 data, but it is returning September data for all
> years in the cube.
>