Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
pra_kale
Creator III
Creator III

How to convert number of days into Month and Year

Hi,

How i can convert number of days coming through 2 date differences into number of months and year.

I want number of months like 15,28,60 that way.

Please help in resolving the issue.

Thanks in advance.

18 Replies
aarkay29
Specialist
Specialist

do you want to round off the year 12.5 to 13

or

how do you want to see it??

pra_kale
Creator III
Creator III
Author

Yes I want to round it off to 13 if months or year are coming to 12.5 , 12.6 or 12.7 then it should round it off to 13.

Anil_Babu_Samineni

Then Use Round()

Round(Expression) -- It will change to Constant value

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
pra_kale
Creator III
Creator III
Author

Yes Thanks Anil I have used this function but it is converting only Year and not months..

I think expression used for to derived months is not giving out-put in decimal..so it is not rounding off.

I have attached the application..

Anil_Babu_Samineni

Is this you are expecting to see in UI

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
pra_kale
Creator III
Creator III
Author

Hi,

Yes but for Month expression as well..I think It is working only for Year expression.

If you see Month out-put it is not giving any decimal so i am not understanding whether it is rounding it off or not.

aarkay29
Specialist
Specialist

Prasad,

Num of months are months between the dates so they are Intergers i.e they do not have any decimals.

since we are dividing Num of months by 12 we are getting decimals for years which can be rounded of using ROUND function.

pra_kale
Creator III
Creator III
Author

Thanks Aar Kay,

But, weather it is possible i will get a number of months also in a decimal which i will Rounding off later on by Round function.

The reason i require this field also in decimal only because I have a grid in which I have a Values in front of Months. like for 13 months 12000, 14 Months 25000.....36 months 100000 and so on..

So i have to consider the value of a Next month if my Months are 13.5 or more..then i will consider the value of 14 Months and not of 13 months..

pra_kale
Creator III
Creator III
Author

Hi,

Weather it is possible to get the month out_put in decimal, post which i will convert by Round off function..