Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to FindOut Year Month from Date Diff.

Hi,

Please anyone provide me YearMonth Date Diff.

Example:   Date1: 10/07/2000, Date2: 28/03/2012

 

Result I want:  Total Diff: 11.7

How  to do this example.

Kindly Help me.

Regards

Ravi Gupta

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Ravi Gupta,

I think the expression depends on how you define the month difference.

If you define it by calculating the number of month changes, you could use

=(((year('28/03/2012')*12)+month('28/03/2012')) - (((year('10/07/2000')*12)+month('10/07/2000'))))/12

or more general

=(((year(EndDateField)*12)+month(EndDateField)) - (((year(StartDateField)*12)+month(StartDateField))))/12

Hope this helps,

Stefan

View solution in original post

3 Replies
swuehl
MVP
MVP

Ravi Gupta,

I think the expression depends on how you define the month difference.

If you define it by calculating the number of month changes, you could use

=(((year('28/03/2012')*12)+month('28/03/2012')) - (((year('10/07/2000')*12)+month('10/07/2000'))))/12

or more general

=(((year(EndDateField)*12)+month(EndDateField)) - (((year(StartDateField)*12)+month(StartDateField))))/12

Hope this helps,

Stefan

Not applicable
Author

Dear Stefan,

Thanks a lot.

Regrads

Ravi Gupta

Not applicable
Author

Hi Stefen,

When I try to append data in same qvd file then I found some error can you provide me solution & I follow some step Pls check if you hv any concern pls let me know:

I followed following steps, Please check this reply:

Step1:  create qvd file from Excel sheet then store qvd file.

Step2:  concanete qvd file with same excel sheet( one column status change in sheet)

Step3:   After concating I check qvd file then i found no data only found xml represation data but data is not shoing.

these are step are we follow Please find out Code  for your refrence:

let vDateStamp = date(today(), 'DDMMYYYY');

IF  filetime('E:\Path MIS\New_Data_MIS\ResourceFile_Temp.qvd')>0 THEN

ResourceFile:
LOAD RES_ID,
     RES_NAME,
     STATUS
FROM 
(biff, embedded labels, table is Sheet1$);

Concatenate

LOAD * FROM E:\Path MIS\New_Data_MIS\ResourceFile.qvd;

STORE ResourceFile INTO E:\Path MIS\New_Data_MIS\ResourceFile.qvd;

ELSE

ResourceFile:
LOAD RES_ID,
     RES_NAME,
     STATUS
FROM 
(biff, embedded labels, table is Sheet1$);

END IF

STORE ResourceFile INTO E:\Path MIS\New_Data_MIS\ResourceFile.qvd;

DROP table ResourceFile;

can any one help me.

Regards

Ravi Gupta