Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi
In my chart I am trying this expression to get product age
timestamp(Date(today()) - Date(poentrydate), 'Y') * 12 + timestamp(Date(today()) - Date(poentrydate), 'M')
so that i will get age in months .
but using above expression getting high values .. y? can someone help me?
also when i just use
timestamp(Date(today()) - Date(poentrydate), 'Y')
i am getting right answer adding multilplying getting big values
Hi
What you need is:
(Year(Today()) - Year(poentrydate)) * 12 + Month(Today()) - Month(poentrydate)
Hope that helps
Jonathan
Hi
What you need is:
(Year(Today()) - Year(poentrydate)) * 12 + Month(Today()) - Month(poentrydate)
Hope that helps
Jonathan
i wrote same expression before and guess what i was not seeing anything so i thought i am not getting answer
but my window was small and answer was coming but i had to scrollll .. wasted so much time..
Thanks Jonathan
Can you just explain why i was getting big numbers???
Hi
Because timestamp(.., 'Y') does not convert the date to a year number - it formats it to display only a year number, but is internally unchanged. Therefore you were mutliplying a date number (a number of about 41000) by 12. The same applies to timestamp(..., 'M').
The correct way to convert the values are the Year and Month functions.
Regards
Jonathan
thank you Jonathan