This can be achieved using the below formula
Time elapsed in days:
if [Time Name] = "Launch to Date"
datediff("day",[Shiepment Date],[End Date])
Please find the sample workbook attached
Hope this helps
Book1.twbx 16.3 KB
That will only work if I am doing calculations for Launch to Date. I need to calculate for all the time periods keeping the reference date to the end date of launch to date.
praveen's solution gets you part of the way there. We just need to make the End Date dynamic.
You can create a parameter to allow the user to select the Time Name (from a list).
Then create a calculated field for EndDate as:
IF [Time Name] = 'Launch to Date' THEN TODAY()
ELSEIF [Time Name] = 'Current Year' THEN DATE('12/31/'+STR(YEAR(TODAY())) )
ELSEIF [Time Name] = 'Current Month' THEN DATETRUNC('month',DATEADD('month',1,TODAY())) - 1
Now you can use EndDate in the DATEDIFF function praveen supplied.
Attached is an example.
Book1.twbx 14.2 KB