Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a expression where i am finding remaining days with exression
contractlineenddate - today().
But i want to display no of days as months and days
like 95 days becomes 3 months 5 days.
Can someone pls help me?
Kind Regards
Manu
I'm going to assume that you don't simply mean (95/30) to show months and then take the remainder as days, that you want to recognise that one of those months is 30 days and the other two might be 31.
This being the case, this syntax in your load script works and produces two fields, a Difference in Months and a Difference in Days.
You can add this as a preceding load to your table if you like.
IF(Day(ContractEndDate)>=Day(CurrentDate)
,((Year(ContractEndDate)*12)+Month(ContractEndDate)) - ((Year(CurrentDate)*12)+Month(CurrentDate))
,IF(Day(ContractEndDate)<Day(CurrentDate)
,(((Year(ContractEndDate)*12)+Month(ContractEndDate)) - ((Year(CurrentDate)*12)+Month(CurrentDate))) - 1
)) AS Difference_NumberOfMonths
IF(Day(ContractEndDate)>=Day(CurrentDate)
,Day(ContractEndDate) - Day(CurrentDate)
,IF(Day(ContractEndDate)<Day(CurrentDate)
,Day(MonthEnd(CurrentDate)) - Day(CurrentDate) + Day(ContractEndDate)
)) AS Difference_NumberOfDays