IcCube - Get yesterday's Member in MDX Query -
i have date dimension looking [date].[date].[day].[yyyy-mm-dd]
, member representing yesterday i.e. [date].[date].[day].[2016-07-27]
. how can accomplish this.
in threads mdx, not iccube specific, written this:
1. strtomember("[date].[date].[day].["+ format(now()-1,"yyyy-mm-dd") +"]")
2. strtomember("[date].[date].[day].["+ vbamdx.format(vbamdx.now()-1,"yyyy-mm-dd") +"]")
the first solution throws error stating 'unknown function format' , error in second solution reads '"vbamdx.now()" expecting single parameter "index"'. same goes vbamdx.format if replace vbamdx.now now. pages explaining vbamdx have 2 parameters format , none now...
i guess because excel format not supported (error reporting has been improved in latest version of iccube). instead use functions mentionned in page:
strtomember( "[time].[calendar].[day].&["+ datetostring( now()-1,"yyyy-mm-dd") +"]")
but in iccube you've lookupbykey function more robust solution if key date :
lookupbykey( [time].[calendar].[day], now() )
or if need date :
lookupbykey( [time].[calendar].[day], today() )
you can navigate dates functions (doc).
hope helps.
Comments
Post a Comment