Re: mdx: last valid price
- From: Darren Gosbell <dgosbell_at_yahoo_dot_com>
- Date: Wed, 14 Sep 2005 08:52:55 +1000
You can do this using a recursive calculation, it might take a while to
run, but it should be possible to do using something like
WITH MEMVER [Measures].[LastPrice] as 'iif([Measures].[Price]=0,
(Time.PrevMember,[Measures].[LastPrice]),Measures.[Price])
Note that the member refers to itself in the formula, this is what makes
the recursion work.
This is a very basic example, if you need this calculation to work over
all the hierarchies of the time dimension there are other things you
would need to add to get this to work, but this should solve the issue
you outlined in your original post.
--
Regards
Darren Gosbell [MCSD]
<dgosbell_at_yahoo_dot_com>
Blog: http://www.geekswithblogs.net/darrengosbell
In article <1126617339.420846@xxxxxxxxxxxxxxxxxx>, ramblk2@xxxxxxxxxxx
says...
> Phil,
>
> thanks you for you answer. But this solution does not work for me :).
> Answer to your prev notes: the price can change when ever, several times in
> month, or it could not change for a months. If the price did not change in
> current month or day, calc member must show the last valid price.
> The logic should be like:
>
> if the Price is not null, show me exactly this value, else show the prev not
> null value.
>
> Additional help would be very appreciated.
>
> Ramunas
>
>
> "SQL McOLAP" <SQLMcOLAP@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:ECB2FA82-9680-49A4-8096-1A4CF27A94A0@xxxxxxxxxxxxxxxx
> > Right after I wrote this, I saw an answer Pras had for a similar problem
> for
> > inventory. Doing a tail of a filtered set could do this:
> >
> >
> Tail(Filter(Descendants([Time].currentmember),([Measures].[Price])>0),1).ite
> m(0)
> >
> > ..although it could be slow if there are a lot of records.
> >
> > Good luck.
> >
> > (and thanks Pras!!!)
> >
> > - Phil
> >
> > "SQL McOLAP" wrote:
> >
> > > Ramunas -
> > >
> > > I'm trying to think of a way this can be done natively in the cube and
> > > nothing jumps out at me. Is there a pattern, like a specific day of the
> > > month a price can change for an item? Or can it happen at any point?
> If it
> > > can happen at any point, this will be difficult in MDX. LastSibling and
> > > LastChild and ClosingPeriod only work for the last member or child of a
> > > member. If these prices can change at anytime, it might be difficult.
> > >
> > > My first suggestion, while trying to figure out an OLAP solution, would
> be
> > > to create a column in your SQL table or view called "last valid price"
> and
.
- Follow-Ups:
- Re: mdx: last valid price
- From: Ramunas Balukonis
- Re: mdx: last valid price
- References:
- mdx: last valid price
- From: Ramunas Balukonis
- RE: mdx: last valid price
- From: SQL McOLAP
- RE: mdx: last valid price
- From: SQL McOLAP
- Re: mdx: last valid price
- From: Ramunas Balukonis
- mdx: last valid price
- Prev by Date: RE: median as a derived measure
- Next by Date: Re: VBA Functions implementation with 64 bit MSAS 2000
- Previous by thread: Re: mdx: last valid price
- Next by thread: Re: mdx: last valid price
- Index(es):
Relevant Pages
|