Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Milaf
Contributor III
Contributor III

Assign the difference between 2 variables to a new variable

Hi,

I need to somehow get the difference between two dates assigned to variables and assign it in a new variable, what am I missing?

QFlag:
LOAD
EmptyColumn,
DateColumn
FROM [lib://QVDFilePath/QFlag.qvd]
(qvd);

LET vData=Peek('DateColumn', 0, Timestamp(QFlag,'YYYY/MM/DD hh:mm/ss'));
LET DateNow = Timestamp(Now(),'YYYY/MM/DD hh:mm/ss');
Let vMinus = Interval(($vData- $DateNow ), 'mm');

Drop Tables QFlag;

Trace '$(vData)';
Trace '$(DateNow)';

Results: 

Milaf_0-1714739357708.png

Thank you.

Labels (1)
2 Solutions

Accepted Solutions
MatheusC
Specialist
Specialist

@Milaf 
try like this:

Let vMinus = interval(Timestamp#('$(vData)','YYYY/MM/DD hh:mm/ss') - Timestamp#('$(DateNow)','YYYY/MM/DD hh:mm/ss'),'hh:mm');


Regarts, Matheus
 

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!

View solution in original post

Milaf
Contributor III
Contributor III
Author

Thank You MatheusC,

It Works! 🙂 But result is ;

Milaf_0-1714976331489.png

 

View solution in original post

2 Replies
MatheusC
Specialist
Specialist

@Milaf 
try like this:

Let vMinus = interval(Timestamp#('$(vData)','YYYY/MM/DD hh:mm/ss') - Timestamp#('$(DateNow)','YYYY/MM/DD hh:mm/ss'),'hh:mm');


Regarts, Matheus
 

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
Milaf
Contributor III
Contributor III
Author

Thank You MatheusC,

It Works! 🙂 But result is ;

Milaf_0-1714976331489.png