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

I need to extract the exact number of years between two years

Hello:

I need to extract the exact number of years between two date.

for Examplo,

If startdate = 30/04/2006

And

enddate = 15/04/2014

Result to obtain is 7 years and 11 months

To put a range for 1 to 7 years that person should not leave me.

Because it has more than 7 years

How do to limit that option and just go down the 7

helpme

please

3 Replies
its_anandrjs

Take a load like this

Set DateFormat = 'DD/MM/YYYY';

LOAD *,

Age([End Date],[Start Date]) & ' Years '

&

IF(month([Start Date]) < month([End Date]),

mod((month([End Date]) - month([Start Date])) + (Day([Start Date]) > Day([End Date])),12)  & ' Months ',

mod(12-(month([Start Date]) - month([End Date])) + (Day([Start Date]) > Day([End Date])),12)  & ' Months ' )

&

if(Day([End Date])> Day([Start Date]), Day([End Date])-Day([Start Date]) & ' Days', day(monthend([Start Date]))-day([Start Date])+day([End Date]) & ' Days') as Diff;

LOAD * INLINE [

End Date, Start Date

15/04/2014, 30/04/2006

];

MK_QSL
MVP
MVP

Please check enclosed file...

Instead of DOB and Today(), you can use StartDate and EndDate

Full Age is what you are looking for as per my file..

Not applicable
Author

  Hello:

I need to calculate in the expression the years exact.qlikview.bmp

If(escoger2 ='Emp. Con Año de Servicio',

  If (Age(Vstartdate,EmpRelFchIng) >=Ainicial and Age(Vstartdate,EmpRelFchIng) <= Binicial ,EmpCod),

in real-time.

helpme

please