If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Days Difference

Started by pavan522, 04 Jan 2014 11:51:19 PM

Previous topic - Next topic

pavan522

    Hi All,

          Here is my scenario...

                        I have  2 columns with product line and date
                             for ex
PL      Date      Days Difference
            
A      05-Jan-13      0
B      06-Jan-13      1
C      10-Jan-13      4
D      15-Jan-13      5

I need third columns as mentioned above.





HalfBloodPrince

Try this

running-difference ([Date])

pavan522

Running-Difference is not working...

navissar

Running-difference needs a numeric value.
So, how do we turn a date field to a numeric field? There are several methods. Since you are particularly interested in the days difference, I'd go with the following:
_days_between ([Date],1900-01-01)
What this will do is return the number of days since January 1st 1900, a date on which I'm fairly certain you have no relevant data, and the date in the Date field.
So, you'll want to do something like this:
running-difference(_days_between ([Date],1900-01-01))

lclove

if  FM model
try
select t.datedate,
       lead(datedate) over(order by datedate) next_date,
       lead(datedate) over(order by datedate) - datedate difference