Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
beck_bakytbek
Master
Master

Differences in Years and in Months

Hi Folks, i have a question:

my table does look like:

Project     ReportDate     EndDate      Difference in Months

A            31.03.2018     30.06.2021          39 Months

I am using this function:

step1 : SET MonthDiff = Num(((year($2) * 12) + month($2))-(((year($1) * 12) + month($1))) + 1)

step2: $(MonthDiff(ReportDate, EndDate)) AS MonthsDifference

with this Function i can calculate only differences as interval 40 Months.

My expected Output is

Project  

A                

Restmonth this Year   = 9

Restmonth this Year + 1 Year = 12

Restmonth this Year + 2 Years = 18

Sum: 39 Months

Does anybody have any idea how to resolve this issue?

Thanks a lot

Beck

10 Replies
beck_bakytbek
Master
Master
Author

Hi Sunny,

thanks a lot for your help and your time, it does look great, this is the sollution for my issue.

Thanks a lot