Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDX Question: Last 12 items in Calc Set

Status
Not open for further replies.

Welshbird

IS-IT--Management
Jul 14, 2000
7,378
0
0
DE
I'm using a .cub viewed with ProClarity and trying to create a dynamic set.

The dimension in question is WEEKS and the data is in the format of CCYYWW e.g. this week is 200725.

I have the following bit of MDX that finds me the most recent week:

Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0)

but what I really want is to create a dynamic set that shows each of the last say, 12 weeks. I'm sure there just must be a lag or something in here, but I can't make it work.

Oh, this cube doesn't have a proper time dimension, as the data just doesn't have a proper concept of time in the usual format. Not sure if this makes a difference.

I'd really appreciate any help here guys.

Thanks,

Fee

The question should be [red]Is it worth trying to do?[/red] not [blue] Can it be done?[/blue]
 
Ne'mind. I found out how to do it:

Code:
{ 
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0).Lag(12), 
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0).Lag(11), 
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0).Lag(10), 
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0).Lag(9), 
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0).Lag(8), 
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0).Lag(7), 
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0).Lag(6), 
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0).Lag(5), 
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0).Lag(4), 
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0).Lag(3), 
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0).Lag(2), 
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0).Lag(1),    
Tail(NonEmptyCrossJoin([Week].Members)).Item(0).Item(0) }

Alls well that ends well.

Fee

The question should be [red]Is it worth trying to do?[/red] not [blue] Can it be done?[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top