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

months between two dates

Started by Nandini.t, 29 Dec 2011 12:41:32 AM

Previous topic - Next topic

Nandini.t

hi all,

How to get months between two dates which is in the format yyyy/mm.
eg : 2003/08 and 2000/12


Thanks for any help in advance....

HalfBloodPrince

#1
what you want to calculate No. of months between two dates(Difference) or Month Names between this two Dates ?

Nandini.t

No. of months between two dates(Difference)

blom0344

A relative easy calculation would be to take the year part of the item  , multiply this by 12 and add the month value. Subtracting these 2 values would yield the difference in months.

Assuming the item is in string format:

cast(substring([someitem],1,4),integer)*12 + cast(substring([someitem],6,2),integer)

2003/08  would yield: 24044
2000/12 would yield:  24012

difference =  24044-24012  =  32 months


barrysaab

Thanks,blom0344,What if it is Month Names between this two Dates ?
Boy! Cognos getting on to me!!!

blom0344

A difference would yield a numerical value. I honestly do not understand your question. Please elaborate !!

MFGF

Do you mean you want to supply two dates and see all the months between those two dates displayed? If so, you need to display the Month item in your report, and add a filter which prompts for the start date and end date required.

Regards,

MF.
Meep!