dbTalk Databases Forums  

Measure value difference over time

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Measure value difference over time in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
lc
 
Posts: n/a

Default Measure value difference over time - 10-07-2003 , 06:22 AM







Pardon my newbie questions.

I think I need a calculated measure that involves Time Dimension (y/q/m/d),
linked to (any/selected) measures, that shows a difference between two
adjacent time slices.

Something like this (from the perspective of Excel & Pivot Table):

Client Time
2003
Quarter2 Quarter3 Variance Quarter4 Variance
A 45 51 6 55
4
B 39 37 -2 38
1
....

Is anything like this possible without involving RDB to begin with? Note: I
use SQL7 OLAP.

TIA

lc



Reply With Quote
  #2  
Old   
Brian Altmann
 
Posts: n/a

Default Measure value difference over time - 10-07-2003 , 07:32 AM






You can use the prevmember function, as in:

(time.currentmember,measures.[my measure]) -
(time.prevmember,measures.[my measure])

If you have many measures and you donīt want to define a
calc measure for each one then you would need an extra
dimension (say Periodicity] with one stored member, say
Regular, and a calc member such as:

(time.currentmember,periodicity.regular) -
(time.prevmember,periodicity.regular)

HTH,
Brian
www.geocities.com/brianaltmann/olap.html



Quote:
-----Original Message-----

Pardon my newbie questions.

I think I need a calculated measure that involves Time
Dimension (y/q/m/d),
linked to (any/selected) measures, that shows a
difference between two
adjacent time slices.

Something like this (from the perspective of Excel &
Pivot Table):

Client Time
2003
Quarter2 Quarter3 Variance
Quarter4 Variance
A 45 51
6 55
4
B 39 37 -
2 38
1
....

Is anything like this possible without involving RDB to
begin with? Note: I
use SQL7 OLAP.

TIA

lc


.


Reply With Quote
  #3  
Old   
lc
 
Posts: n/a

Default Re: Measure value difference over time - 10-07-2003 , 05:46 PM




"Brian Altmann" <brianaltmann (AT) yahoo (DOT) com> wrote

Quote:
(time.currentmember,measures.[my measure]) -
(time.prevmember,measures.[my measure])
This works perfectly. Thanks a million.

Quote:
If you have many measures and you donīt want to define a
calc measure for each one then you would need an extra
dimension (say Periodicity] with one stored member, say
Regular, and a calc member such as:

(time.currentmember,periodicity.regular) -
(time.prevmember,periodicity.regular)
I don't think I understand (yet), but will try a few things before I'd abuse
your time again.

Thanks a lot.

Quote:
HTH,
Oh, yes, Big Time.

lc




Reply With Quote
  #4  
Old   
lc
 
Posts: n/a

Default Re: Measure value difference over time - 10-09-2003 , 04:57 AM




"Brian Altmann" <brianaltmann (AT) yahoo (DOT) com> wrote

Quote:
If you have many measures and you donīt want to define a
calc measure for each one then you would need an extra
dimension (say Periodicity] with one stored member, say
Regular, and a calc member such as:

(time.currentmember,periodicity.regular) -
(time.prevmember,periodicity.regular)
Hmmm, this didn't work after all. So, I added to my fact table a varchar
field and filled it value of 'Variance'. Then I created a dimension
(Variances) out of it and used it in calc member formula:

(time.currentmember, [Variances].[All Variances].[Variance])
- (time.prevmember, [Variances].[All Variances].[Variance])

All I get is error in that field. What did I miss (if it's obvious to you)?

Thanks a lot.

lc




Reply With Quote
  #5  
Old   
Brian Altmann
 
Posts: n/a

Default Re: Measure value difference over time - 10-09-2003 , 07:56 AM



Sorry I was not clear, of course you need the extra field
in the fact table to link to the extra dimension.
I prefer to create the dimension ([Variances] or
Periodicity) out of a one-record table instead of creating
it out of the fact table column because the design is
clearer and processing is more efficient.
Still your solution should work as long as the calc member
belongs to the [Variances] dimension.
HTH,
Brian

Quote:
-----Original Message-----

"Brian Altmann" <brianaltmann (AT) yahoo (DOT) com> wrote in message
news:0f2d01c38ccf$0159b100$a301280a (AT) phx (DOT) gbl...
If you have many measures and you donīt want to define a
calc measure for each one then you would need an extra
dimension (say Periodicity] with one stored member, say
Regular, and a calc member such as:

(time.currentmember,periodicity.regular) -
(time.prevmember,periodicity.regular)

Hmmm, this didn't work after all. So, I added to my fact
table a varchar
field and filled it value of 'Variance'. Then I created a
dimension
(Variances) out of it and used it in calc member formula:

(time.currentmember, [Variances].[All Variances].
[Variance])
- (time.prevmember, [Variances].[All Variances].
[Variance])

All I get is error in that field. What did I miss (if
it's obvious to you)?

Thanks a lot.

lc


.


Reply With Quote
  #6  
Old   
lc
 
Posts: n/a

Default Re: Measure value difference over time - 10-14-2003 , 06:58 AM




"Brian Altmann" <brianaltmann (AT) yahoo (DOT) com> wrote

Quote:
Sorry I was not clear, of course you need the extra field
in the fact table to link to the extra dimension.
I prefer to create the dimension ([Variances] or
Periodicity) out of a one-record table instead of creating
it out of the fact table column because the design is
clearer and processing is more efficient.
Still your solution should work as long as the calc member
belongs to the [Variances] dimension.
I had a hunch that might be a problem so I went ahead and created a
one-record table just for this. Unfortunately, this didn't do it either.
Perhaps it's my design of this Periodicity dimension. What I did:

new table Periodicities( PerCode int, PerDescr varchar( 11 ) )
insert into Periodicities values( 1, 'Periodicity' )
created a shared dimension Periodicity
added PerCode to the fact table
created a calc field (Variance) that looks like:

( [WE Dates].CurrentMember, [Periodicities].[All
Periodicities].[Periodicity] )
- ( [WE Dates].PrevMember, [Periodicities].[All
Periodicities].[Periodicity] )

Still getting errors in Variance field. Do you have any idea what am I
missing?

Thanks a lot for your time Brian.

lc




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.