Problem in calculating Current Month and previous month values


following link create current , previous month , getting error,
i tried every cobinations , still not getting desired result
http://blogs.conchango.com/christianwade/archive/2006/06/23/mdx-script_3a00_-current_2f00_relative-period.aspx

after before following thsi method had 2 time dimensions current year,prev year , ytd
and working fine.
now according new requirment have create current month , previous month.
so followed lik above add new calculations,except new calculations rest working fine

i have 1 tine dimension , 1 time shell dimension,since new few new calculatiosn current month , previous month
so went ahead , created them using scripts

create member currentcube.[time calculations cost].[time calculations].[current month] as null, visible = 1;
now used script follow calculatiosn

([time calculations cost].[time calculations].[current month],{

[measures].[pct perfect],

[measures].[epay lines perfect],

[measures].[total number of invoices pct perfect]

} ) =

sum(

{[time calculations].[current year].defaultmember} *

members(

"[time_cost].[month].[" + vba!format(vba!dateadd("m", -2, vba!now()), "mmm-yy") + "]"

)

)

;
but when brows cube following error
"the default member function expect hierarchy expression argument.the member expression used."

in time_cost  have key,month,qt,year , date , hierarchy year-->qt-->month-->date
i tried every thing put every  possible combinations in place of "[time_cost].[month]., tried year etc couldn't resolve.
i using -2 because still have november data.
how can resolve ,let me know

also assume problem in future because kind of hardcoaded show 2 months older data lets suppose have dec data do,is there functin shows current months data available
i tried tail(nonempty([time_cost].[year].members),1).item(0) tfhis weired because doesn't process cube , when check in profiler found there wasn't connection.

any help,suggesations


d

immediate cause of error expression:
[time calculations].[current year].defaultmember

from can see, [time calculations].[current year] not same of hierarchy on shell dimension name of calculated member - hierarchy can have default member. try following instead:
[time calculations cost].[time calculations].defaultmember

does work?

chris

blog: http://cwebbbi.spaces.live.com consultancy: http://www.crossjoin.co.uk/


SQL Server  >  SQL Server Analysis Services



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........