dbTalk Databases Forums  

Current Year

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


Discuss Current Year in the microsoft.public.sqlserver.olap forum.



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

Default Current Year - 02-19-2004 , 01:51 PM






Please let me know how to find the Current Year in MDX. When I type Year(Date()) I get some huge incorrect numbe

Thanks

Reply With Quote
  #2  
Old   
Tom Chester
 
Posts: n/a

Default Re: Current Year - 02-19-2004 , 02:34 PM






Depends. Is it the last year in the year level? Or the last year containing
data? Or based on system date?

public @ the domain below
www.tomchester.net

"PNG" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Please let me know how to find the Current Year in MDX. When I type
Year(Date()) I get some huge incorrect number


Thanks



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

Default Re: Current Year - 02-19-2004 , 02:56 PM



It is like this
Year is 2003 and 2004 with Quarter and Months; What i need to find out is the value of current year from my dimension and this should be 2004;
But I don't know what MDX to use;

Reply With Quote
  #4  
Old   
Tom Chester
 
Posts: n/a

Default Re: Current Year - 02-19-2004 , 03:10 PM



Still don't know what defines "the current year". This will give you the
last year in the dimension assuming you have an ALL member:
Time.[All Time].LastChild

This will work regardless if there is an ALL:
Tail(Year.Members,1).Item(0).Item(0)

public @ the domain below
www.tomchester.net

"PNG" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
It is like this:
Year is 2003 and 2004 with Quarter and Months; What i need to find out is
the value of current year from my dimension and this should be 2004;
But I don't know what MDX to use;



Reply With Quote
  #5  
Old   
PNG
 
Posts: n/a

Default Re: Current Year - 02-20-2004 , 09:46 AM



Hi To
Both of these don't work
My Year dimension is called Accounting Period and it is defined as below
2003 YT
Quarter
Month

2004 QT
Quarter
Month

Now I have a column called Loss Paid in one of the Dimension whose value will change if the Accounting Period Changes; If the User select 2004 it should be "A" and if the user select 2003 it should be "B
But I am not able to figure out how to write MDX and figure out the Year chosen by the User

Bothe of the formulas given by you gives me #ER

----- Tom Chester wrote: ----

Still don't know what defines "the current year". This will give you th
last year in the dimension assuming you have an ALL member
Time.[All Time].LastChil

This will work regardless if there is an ALL
Tail(Year.Members,1).Item(0).Item(0

public @ the domain belo
www.tomchester.ne

"PNG" <anonymous (AT) discussions (DOT) microsoft.com> wrote in messag
news:3A0A0C97-8B38-4A8E-944B-34D9D4E9D436 (AT) microsoft (DOT) com..
Quote:
It is like this
Year is 2003 and 2004 with Quarter and Months; What i need to find out i
the value of current year from my dimension and this should be 2004
But I don't know what MDX to use




Reply With Quote
  #6  
Old   
Tom Chester
 
Posts: n/a

Default Re: Current Year - 02-20-2004 , 12:25 PM



OK, let's try substituting the real object names for the tokens I used...
[Accounting Period].[All Accounting Period].Last Child

If you have no ALL member in the dim, use the next formula except substitute
Year with the name of *your* year level:
Tail(Year.Members,1).Item(0).Item(0)

These expressions by themselves are incomplete -- they simply reference the
last year on the year level. To test the syntax add ".Name" to the end, like
so:

[Accounting Period].[All Accounting Period].Last Child.Name

As to how to apply these expressions to your situation, I'm not clear what
you're trying to do.

public @ the domain below
www.tomchester.net

"PNG" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi Tom
Both of these don't work ;
My Year dimension is called Accounting Period and it is defined as below:
2003 YTD
Quarters
Months

2004 QTD
Quarters
Months

Now I have a column called Loss Paid in one of the Dimension whose value
will change if the Accounting Period Changes; If the User select 2004 it
should be "A" and if the user select 2003 it should be "B"
Quote:
But I am not able to figure out how to write MDX and figure out the Year
chosen by the User.

Bothe of the formulas given by you gives me #ERR

----- Tom Chester wrote: -----

Still don't know what defines "the current year". This will give you
the
last year in the dimension assuming you have an ALL member:
Time.[All Time].LastChild

This will work regardless if there is an ALL:
Tail(Year.Members,1).Item(0).Item(0)

public @ the domain below
www.tomchester.net

"PNG" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:3A0A0C97-8B38-4A8E-944B-34D9D4E9D436 (AT) microsoft (DOT) com...
It is like this:
Year is 2003 and 2004 with Quarter and Months; What i need to find
out is
the value of current year from my dimension and this should be 2004;
But I don't know what MDX to use;






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.