![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I found this code on www.databasejournal.com and it looks like it will do what I want. However this code ages from 12/31/1997. What I need it to do, is age from the currently selected member in the cube. This code is currently constructing a shared dimension. Any ideas? IIF(DateDiff('d', "time_by_day"."the_date", '12/31/1997')< 30, 29,IIF(DateDiff('d', "time_by_day"."the_date", '12/31/1997')>= 30 AND DateDiff('d',"time_by_day"."the_date", '12/31/1997')<= 60, 60, IIF(DateDiff('d',"time_by_day"."the_date", '12/31/1997')>= 61 AND DateDiff('d',"time_by_day"."the_date", '12/31/1997')<= 90, 90, IIF(DateDiff('d',"time_by_day"."the_date", '12/31/1997')>= 91 AND DateDiff('d',"time_by_day"."the_date", '12/31/1997')<= 120, 120, 999)))) Clint |
#3
| |||
| |||
|
|
Hi Clint - The thing to do is to get the name of the time currentmember, and then in another calc member convert it to a date so datediff can work. As long as your member names for your day members are something that can be converted by a cdate(), you should be OK. Something like: with member [measures].[CurrTimeName] as '[Time].CurrentMember.Name' member [measures].[DaysDiff] as 'DateDiff("d",CDate([measures].[CurrTimeName]), Now())', solve_order = 10 member [measures].[Age] as 'IIF([measures].[DaysDiff] > 30,30, etc...)' solve_order = 20 The above example will get the difference between the selected time member and today. You can combine these steps if you like, I just thought splitting them out would make it easier to understand. Good luck. - Phil "AshVsAOD" wrote: I found this code on www.databasejournal.com and it looks like it will do what I want. However this code ages from 12/31/1997. What I need it to do, is age from the currently selected member in the cube. This code is currently constructing a shared dimension. Any ideas? IIF(DateDiff('d', "time_by_day"."the_date", '12/31/1997')< 30, 29,IIF(DateDiff('d', "time_by_day"."the_date", '12/31/1997')>= 30 AND DateDiff('d',"time_by_day"."the_date", '12/31/1997')<= 60, 60, IIF(DateDiff('d',"time_by_day"."the_date", '12/31/1997')>= 61 AND DateDiff('d',"time_by_day"."the_date", '12/31/1997')<= 90, 90, IIF(DateDiff('d',"time_by_day"."the_date", '12/31/1997')>= 91 AND DateDiff('d',"time_by_day"."the_date", '12/31/1997')<= 120, 120, 999)))) Clint |
![]() |
| Thread Tools | |
| Display Modes | |
| |