This is a discussion on MDX expression in MSAS within the SQL Server Data Warehousing forums, part of the Microsoft SQL Server category; --> Hi, I would like to add new Calculated Member and build MDX expression that evaluate it. I've got an ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I would like to add new Calculated Member and build MDX expression that evaluate it. I've got an Amount measure and want to add Sum_Amount calculated member. Here is an example how it should work: Amount Sum_Amount 01 Jan 2002 100 100 02 Jan 2002 200 300 03 Jan 2002 150 450 The Sum_Amount value for a specified day is a: 1) sum of Amount value for the day and Sum_Amount value for the previous day (see 03 Jan 2002: 150 + 300 = 450) or 2) sum of Amount values from the beginning of the year up to specified day (eg. if the specified day is 03 Jan 2002 it should be: 100+200+150 = 450) Additionally, the value of Sum_Amount should start with '0 + Amount' for every year (see example - 01 Jan 2002 we have 0 + 100 = 100). It should work on every level of the time hierarchy, I mean Year-Quarter-Month-Day. I don't know how to do it. could anyone tell me how the expression that evaluate it should be? thanks Edmo |
| ||||
| Marius Dumitru [MS] wrote: > Please consider using the PeriodsToDate function, e.g.: > > Create Member MyCube.Measures.SumAmount As 'Sum(PeriodsToDate(Time.Year), > Measures.Amount)' thanks very much, looks, it works I made my own expression but much more complicated and it had some bugs. I felt a little ashamed when I saw how easy it can be. thanks once again Edmo |