dbTalk Databases Forums  

Current Date

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


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



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

Default Current Date - 05-10-2005 , 05:09 PM






Hello

Can I create a calculated member in the time dimension that will always
represent the current date or current date - 1?

Thank You



Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Current Date - 05-10-2005 , 06:07 PM






Assuming that your Time dimension already has [Day] members for the
current date, you can use the VBA Now() function:

http://groups-beta.google.com/group/...rver.olap/msg/
d10acbc0713a7de8?hl=en
Quote:
Newsgroups: microsoft.public.sqlserver.olap
From: George Spofford <geo... (AT) dsslab (DOT) com>
Date: Tue, 28 Jan 2003 08:00:11 -0500

Subject: Re: Find Current Date

By using the VBA!Now() function (part of the VBA library).

To use it to look up a time member whose name is something like "Jan 28,
2003", try:

StrToMember ("[Time]." + VBA!Format (VBA!Now(), "\[mmm dd, yyyy\]"))

HTH

naseer78 wrote:
Quote:
Hello!

I am new in MDX, How I find current date in MDX?

Thankx in advance.

Naseer

--
Posted via http://dbforums.com

--
George Spofford
Microsoft MVP
Chief Architect / OLAP Solution Provider
DSS Lab
...
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


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

Default Re: Current Date - 05-10-2005 , 07:31 PM



Everyone's concept of "current" tends to vary an it's often not the
current date, but rather the most current data in the cube. I usually
use the most recent time period of some level that has data in the
fact table. Something like this...

Tail(NonEmptyCrossJoin([MyTimeDim].[MyTimeLevel].Members)).Item(0).Item(0)

Replace...[MyTimeDim] with the name of your time dimension...and
replace [MyTimeLevel] with the name of the level in that time dimension
that you want to return for your concept of current (current year,
current month, current day, etc).


Deepak Puri wrote:
Quote:
Assuming that your Time dimension already has [Day] members for the
current date, you can use the VBA Now() function:


http://groups-beta.google.com/group/...rver.olap/msg/
d10acbc0713a7de8?hl=en

Newsgroups: microsoft.public.sqlserver.olap
From: George Spofford <geo... (AT) dsslab (DOT) com
Date: Tue, 28 Jan 2003 08:00:11 -0500

Subject: Re: Find Current Date

By using the VBA!Now() function (part of the VBA library).

To use it to look up a time member whose name is something like "Jan
28,
2003", try:

StrToMember ("[Time]." + VBA!Format (VBA!Now(), "\[mmm dd, yyyy\]"))

HTH

naseer78 wrote:
Hello!

I am new in MDX, How I find current date in MDX?

Thankx in advance.

Naseer

--
Posted via http://dbforums.com


--
George Spofford
Microsoft MVP
Chief Architect / OLAP Solution Provider
DSS Lab
..



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


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.