Introduction
You can use MDX to determine the current day dynamically with VB functions. MDX supports VB functions, and you can use them directly in MDXScript (when defined in Models/Cubes) or within your variables when used as part of your Form Definition.
Example
By using a combination of VB functions, you can dynamically resolve a Member in MDX:
select
{
StrToMember("[Time].[Fiscal Calendar].&["
+ CStr(Year(Now())) -- 2015
+ Right("0" + CStr(Month(Now())), 2) -- 08
+ "00]")
}
on 0
from Finance
Run the examples below to see the results:
-- show the value of Year(Now())
with
member time_days.memberid.year as 'Year(Now())'
select { time_days.memberid.year } on 0 from $time_days
-- show the value of Month(Now())
with
member time_days.memberid.month as 'Month(Now())'
select { time_days.memberid.month } on 0 from $time_days
-- show the value of Day(Now())
with
member time_days.memberid.day as 'Day(Now())'
select { time_days.memberid.day } on 0 from $time_days