![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Could you clarify the relationship between "order date" and "last order date" - what do they represent? In your example, the order date of 01/01/2006 also has a last order date of 01/01/2006. But the order date of 05/02/2006 still has a last order date of 01/01/2006, even though 05/02/2006 is listed as a last order date in the next line. Also, are you using AS 2000 or AS 2005? - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#4
| |||
| |||
|
|
Hi Deepak, Order date is when an order is placed and last order date is when that customer made the last purchase. If a new order occurs then I use the first order date as my last order date. If a second order occurs I then go onto get the last order date from previous line. This ensures that there is a date in the last order date field. I am using AS2000. I have worked out most of the MDX but the problem I now have is on the datediff function. This is the MDX I use to work out difference in time Measure Datecompare: - datediff("m",[Measures].[datestring],[Order Date].currentmember.properties("Firstday")) The problem is that if datestring measure is null I get an #ERR in a cell. This then stops the following calculated member from being evaluated (Get #Err in all cells) COUNT(Filter(crossjoin(DESCENDANTS([Customer].CURRENTMEMBER,[Customer].[Customerid]),{[Type].[Custtype].&[1]}),[Measures].[datecompare]=0)) If I try to use the IIF around the datediff it does not like it for some reason. Are there any alternatives so I can check for empty cells when using datediff Thanks Deepak Puri wrote: Could you clarify the relationship between "order date" and "last order date" - what do they represent? In your example, the order date of 01/01/2006 also has a last order date of 01/01/2006. But the order date of 05/02/2006 still has a last order date of 01/01/2006, even though 05/02/2006 is listed as a last order date in the next line. Also, are you using AS 2000 or AS 2005? - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#5
| |||
| |||
|
|
Hi Deepak, Order date is when an order is placed and last order date is when that customer made the last purchase. If a new order occurs then I use the first order date as my last order date. If a second order occurs I then go onto get the last order date from previous line. This ensures that there is a date in the last order date field. I am using AS2000. I have worked out most of the MDX but the problem I now have is on the datediff function. This is the MDX I use to work out difference in time Measure Datecompare: - datediff("m",[Measures].[datestring],[Order Date].currentmember.properties("Firstday")) The problem is that if datestring measure is null I get an #ERR in a cell. This then stops the following calculated member from being evaluated (Get #Err in all cells) COUNT(Filter(crossjoin(DESCENDANTS([Customer].CURRENTMEMBER,[Customer].[Customerid]),{[Type].[Custtype].&[1]}),[Measures].[datecompare]=0)) If I try to use the IIF around the datediff it does not like it for some reason. Are there any alternatives so I can check for empty cells when using datediff Thanks Deepak Puri wrote: Could you clarify the relationship between "order date" and "last order date" - what do they represent? In your example, the order date of 01/01/2006 also has a last order date of 01/01/2006. But the order date of 05/02/2006 still has a last order date of 01/01/2006, even though 05/02/2006 is listed as a last order date in the next line. Also, are you using AS 2000 or AS 2005? - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
![]() |
| Thread Tools | |
| Display Modes | |
| |