Jump to content

mmorales

Members
  • Posts

    2
  • Joined

  • Last visited

mmorales's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. In a table that I have, I have a date field that indicates the date an order was placed. I would like to create a calculated field in my datapage that will indicate how long it has been since the order was open (that is, the difference between today's date and the order creation date). Is there any way to do this? I know it will involve Datediff but I am unsure of how to insert today's date automatically. Ex. Order Created - 1/20/16 Today's Date - 2/12/16 The expected output would be 23. Thank you. EDIT: So I've implemented this using the following formula: DATEDIFF(day,OrderDate, GETUTCDATE()) and it works correctly but now I need this to ONLY count business days (at the moment, it is counting weekends as well). EDIT 2: I've figured it out. I will leave the answer here for posterity: To calculate the difference in dates (only considering business days), enter the following into your calculated field: select (DATEDIFF(dd,@StartDate, @EndDate)) - (DATEDIFF(ww,@StartDate, DATEADD(dd,-1,@EndDate)) * 2) - (CASE WHEN DATENAME(dw, @StartDate) = 'Sunday' THEN 1 else 0 end) - (CASE WHEN DATENAME(dw, @EndDate) = 'Sunday' THEN 1 else 0 end) where you replace @StartDate and @EndDate with your corresponding fields (if you're calculating days from today, then use GETUTCDATE() for @EndDate).
  2. I'm currently working on a pivot table and I would like to know if there's any way to change how the pivot table looks. For example, refer to this link. By default, Caspio's pivot table results display in the outline form but I would like to have it display like the tabular form in excel if possible. Cheers
×
×
  • Create New...