dbTalk Databases Forums  

Determine if a date is within a period

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


Discuss Determine if a date is within a period in the microsoft.public.sqlserver.olap forum.



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

Default Determine if a date is within a period - 09-11-2004 , 06:43 AM






Hi,

I am a newbee to OLAP and MS Analysis Services. I have a cube with Time and
Client dimensions. Measures include shipment amount and payment term.
Payment term is an integer number meaning 'should be paid within N days from
shipment date'.

I need to create an MDX query to sum up shipments for which a) payments are
_not_ overdue and b) payments _are_ overdue - in columns '0 to 3 days', '4
to 7 days' and '7+ days' from the shipment date.

My questions are:

1) how do I create a filter which would give me only the shipments for which
payments are _not_ overdue
2) how do I break up the shipments in two columns

I thought that each column should be a calculated member summing up the
data, something like:

with member '0-3' as "Sum ( LastPeriods( 3, Time.CurrentMember. ),
[Measures].[Shipment Amount] )"
with member '4-7' as "Sum ( LastPeriods( 3, Time.CurrentMember.Lag(3) ),
[Measures].[Shipment Amount])"
with member '7+' as "Sum ( PeriodsToDate( Year, Time.CurrentMember.Lag(7) ),
[Measures].[Shipment Amount])"

But I am having a hard time creating filter statement to separate shipments
with overdue and non-overdue payments.

Any ideas would be higly appreciated!

Thanks,

Denys Kotseba



Reply With Quote
  #2  
Old   
Jéjé
 
Posts: n/a

Default Re: Determine if a date is within a period - 09-11-2004 , 06:38 PM






the easy way is to create a dimension which is "delay" linked to your
payment term fact table column.

This new dimension will be:
Overdue Group Key
No 0 0
Yes 1-3 1
Yes 1-3 2
Yes 1-3 3
Yes 4-7 4
etc...


"Denys Kotseba" <kdl2001 @ ukr.net> a écrit dans le message de news:
1094903004.42171 (AT) embrayer (DOT) merlin.net.ua...
Quote:
Hi,

I am a newbee to OLAP and MS Analysis Services. I have a cube with Time
and
Client dimensions. Measures include shipment amount and payment term.
Payment term is an integer number meaning 'should be paid within N days
from
shipment date'.

I need to create an MDX query to sum up shipments for which a) payments
are
_not_ overdue and b) payments _are_ overdue - in columns '0 to 3 days', '4
to 7 days' and '7+ days' from the shipment date.

My questions are:

1) how do I create a filter which would give me only the shipments for
which
payments are _not_ overdue
2) how do I break up the shipments in two columns

I thought that each column should be a calculated member summing up the
data, something like:

with member '0-3' as "Sum ( LastPeriods( 3, Time.CurrentMember. ),
[Measures].[Shipment Amount] )"
with member '4-7' as "Sum ( LastPeriods( 3, Time.CurrentMember.Lag(3) ),
[Measures].[Shipment Amount])"
with member '7+' as "Sum ( PeriodsToDate( Year,
Time.CurrentMember.Lag(7) ),
[Measures].[Shipment Amount])"

But I am having a hard time creating filter statement to separate
shipments
with overdue and non-overdue payments.

Any ideas would be higly appreciated!

Thanks,

Denys Kotseba





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.