[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Counting total days between two dates

Posted on 2014-02-10
3
Medium Priority
?
669 Views
Last Modified: 2016-02-18
I have two dates in my cube, date1 and date2.  I need to count days between those two dates and then sum the result by year basis. I have created a similiar scenario on the Adwenture works cube where I'm trying to show total of days between ship date and delivery date and then show the result by each year by category. I get #error in the 2005 and 2006 measure, how can I show the correct result?

WITH 


MEMBER [Measures].[Ship Date] AS [Ship Date].[Date].membervalue
MEMBER [Measures].[Delivery Date] AS [Delivery Date].[Date].membervalue
MEMBER [Measures].[# of Delivery Days] AS [Measures].[Delivery Date] - [Measures].[Ship Date]
MEMBER  [Measures].[2005] as SUM([Measures].[# of Delivery Days],[Ship Date].[Calendar].[Calendar Year].&[2005])
MEMBER  [Measures].[2006] as SUM([Measures].[# of Delivery Days],[Ship Date].[Calendar].[Calendar Year].&[2006])

SELECT	{
	
[Product].[Category].[Category]
	} ON COLUMNS,
	
	( {[Measures].[2005],[Measures].[2006]}

	) ON ROWS
FROM	[Adventure Works]

Open in new window

0
Comment
Question by:gosi75
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
plusone3055 earned 1500 total points
ID: 39847396
have your tried using the DATEDIFF Function ?

here is an explanation of DATEDIFF function and what it does via MIcrosoft :)

http://technet.microsoft.com/en-us/library/ms189794.aspx
0
 

Author Comment

by:gosi75
ID: 39847422
I'm using OLAP so I don't think DATEDIFF will work for me. Any other succession :)
0
 

Author Closing Comment

by:gosi75
ID: 39853388
I did use datediff, but I added it to my cube as a measure.
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

649 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