Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date vs Last month same date

Hello,

I'm new to qlikview and i need some help with it.

I have a table with some records with dimension "Date" and "a".

What i want is to get values from dimensions "A"  coresponding to same date from last month.

I know how to do this in script, but i want the same result using only expresions in a straight table.

for example:

Records:

DateValue
01-05-20125
02-05-201250
03-05-201217
01-06-201215
02-06-201230
03-06-20122

Result:

DateASame Day LastM
01-06-2012155
02-06-20123050
03-06-2012217

I also attached an example on how to i did it with script .

Tnx in advance for help.

1 Solution

Accepted Solutions
Not applicable
Author

Hiiiii

See the attached file

Hope it helps

in your script

load

DATE(Date#(Date,'DD-MM-YYYY'),'DD/MM/YYYY') AS DATE,

DAY(Date#(Date,'DD-MM-YYYY')) AS Day,

Value

from mytable;

then in straight table--

calculateDimension--   =Aggr(max(DATE),Day)

Expression1---  Aggr(FirstSortedValue(Value,-DATE),Day)

Expression2--   Aggr(FirstSortedValue(Value,DATE),Day)

then outputlike this

DateASame Day LastM
--
01/06/2012155
02/06/20123050
03/06/2012217

View solution in original post

2 Replies
Not applicable
Author

Hiiiii

See the attached file

Hope it helps

in your script

load

DATE(Date#(Date,'DD-MM-YYYY'),'DD/MM/YYYY') AS DATE,

DAY(Date#(Date,'DD-MM-YYYY')) AS Day,

Value

from mytable;

then in straight table--

calculateDimension--   =Aggr(max(DATE),Day)

Expression1---  Aggr(FirstSortedValue(Value,-DATE),Day)

Expression2--   Aggr(FirstSortedValue(Value,DATE),Day)

then outputlike this

DateASame Day LastM
--
01/06/2012155
02/06/20123050
03/06/2012217
Not applicable
Author

if your problem resolved then marked it as either correct or helpful according to your question so that it might be helpful for other developer.

Regards

Vishwaranjan