8 Replies Latest reply on Mar 4, 2016 9:27 PM by Shinichiro Murakami

# Days to Ship - Sample Super Stores - Multiple Count

Hello All

I have created a simple calculated field with the following definition : DATEDIFF("day",[Order Date],[Ship Date]) - But this gives me incorrect values. But if I change the formula with the following definition I get correct values - ATTR(DATEDIFF("day",[Order Date],[Ship Date])). The problem is if I remove the granularity and say add region ( and remove Order ID , Day of Order Date, Day of Ship Date) I would get the '*' and also I am unable to view grand totals for this column. Thanks.

Manish

• ###### 1. Re: Days to Ship - Sample Super Stores - Multiple Count

Manish,

I want to see your workbook to understand the data structure to investigate.

Could you share your packaged workbook(***.twbx), only a sample works.

Thanks,

Shin

• ###### 2. Re: Days to Ship - Sample Super Stores - Multiple Count

Hi Shinichiro

Thanks

• ###### 3. Re: Days to Ship - Sample Super Stores - Multiple Count

As you can see, Order ID is not unique ID and some ID has 4 line items.

That's the reason you don't get correct answer.

If you can define "Uniqueness" of this ID, you can get correct anwer.

I mean for example, pick the oldest/(or newest) date of each Order ID or something.

Thanks,

Shin

1 of 1 people found this helpful
• ###### 4. Re: Days to Ship - Sample Super Stores - Multiple Count

Thanks Shin. I know that an order has got multiple items. So I add RowID it would get me the  perfect results. But if I want to place Region and Days To Ship I get incorrect results. My Question is How to create a Perfect Days to Ship

• ###### 5. Re: Days to Ship - Sample Super Stores - Multiple Count

Manish,

Sorry for late reply. Here you go.

Assuming each Row ID has same Date as long as order Id is same, you can use LOD calculation.

[Days to Ship (copy)]

DATEDIFF("day",{fixed [Order ID]:min([Order Date])},{fixed [Order ID]:min([Ship Date])})

Thanks,

Shin

2 of 2 people found this helpful
• ###### 6. Re: Days to Ship - Sample Super Stores - Multiple Count

Thank you  Shin. Appreciate your help.

• ###### 7. Re: Days to Ship - Sample Super Stores - Multiple Count

You are very welcome.

Have a good weekend!

Shin

• ###### 8. Re: Days to Ship - Sample Super Stores - Multiple Count

BTW,

could you mark the answer as "Correct" for other people to understand it's answered.

Shin