Trying to get a filtered list of years from AW 2008 Cube

Im trying to get a list of years from the Date dimension greater than 2006, but my MDX is not right.

Forgive the newbie question

Get an error such as "

Executing the query ...

Query (3, 49) The > function expects a string or numeric expression for the 1 argument. A level expression was used.

Execution complete"

SELECT

NULL ON COLUMNS


FILTER

(

[Date].[Calendar Year].[Calendar Year].

MEMBERS, [Date].[Calendar Year].[Calendar Year].Members > 2006) ON ROWS


FROM

[Adventure Works];




  • Edited by shiftbit 16 hours 18 minutes ago hjklhjkl
September 9th, 2015 10:45am

Hi shiftbit,

According to your description, you want to get all years after 2006 on rows. Right?

In this scenario, if you want to use filter() function, you need to create a calculated measure to get the member key and use it in logical expression. Please refer to query below:

with member [x] as
[Date].[Calendar].currentmember.member_key
select {} on 0,
filter([Date].[Calendar].[Calendar Year].members,strtovalue([x])>2006) on 1
from
[Adventure Works]

However, we don't have to do that, you just need to apply date range start from Year 2006 end with NULL. Please refer to sample query below:

select {} on 0,
[Date].[Calendar].[Calendar Year].&[2006]:null on 1
from
[Adventure Works]

Reference:
: (Range) (MDX)

Regards,

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 10:15pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics