Solved

Analysis services - MDX date calculation

Posted on 2004-04-07
5
2,682 Views
Last Modified: 2012-08-13
Please advise if I'm in the wrong area to ask this.

I want to make a calculated member "age of employee" based on a dimension attribute
Employee.birth_date

Iimagine this would be something like

truncate( NOW() - Employee.birth_date )

IF MDX does date arithmetic !
Does it? and if so what syntax works?

Otherwise I have read a way ( media.wiley.com/product_data/excerpt/ 67/04714004/0471400467.pdf  dated June 2001)
to do this calling VBA!DateDiff
0
Comment
Question by:starrynighter
  • 2
  • 2
5 Comments
 
LVL 34

Expert Comment

by:arbert
ID: 10780563
We've always taken the route of using DATEDIFF--more robust and you can keep errors from popping up if bad data appears....
0
 
LVL 2

Expert Comment

by:eric_duncan
ID: 10780661
Note that you can use the DATEDIFF function that is intrinsic to TSQL, rather than the VBA one.
0
 
LVL 34

Accepted Solution

by:
arbert earned 130 total points
ID: 10780671
Right all depends on if there are any additional checks you want to perform.  Although, you can perform about the same functions in TSQL.  We already had VBA 'routines' that we were using from other systems though....
0
 

Author Comment

by:starrynighter
ID: 10837246

Thanks both.
0
 

Author Comment

by:starrynighter
ID: 10837907
Thanks both.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
query execution hang 5 29
hyperlink data type in SQL 3 27
Increment column based of a FK 8 22
Have a conversion issue with varchar to int in a SQL: Query. 1 30
Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question