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: 
bobbydave
Creator III
Creator III

Selecting current week and last week

VLN_Date is made up from the filename.  I have

12-11-2018

19-11-2018

26-11-2018

03-11-2018

10-12-2018

17-12-2018

 

I only ever want the last weeks so I need the 17th and the 10th in this case.

 

count({<VLN_Date = {'$(=Max({1}VLN_Date))'}>}Description)      - THE CURRENT WEEK 17TH

COUNT({< VLN_Date = {"$(=Date(Max({1}VLN_Date)-7, 'DD-MM-YYYY') "} >} Description)    - THE PREVIOUS WEEK 10TH

 

Of course this doesn't want to work for me.

Any help appreciated.

 

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Can you try this

Current Week

Count({<VLN_Date = {"$(=Date(Max({1}VLN_Date), 'DD-MM-YYYY'))"}>}Description)

Previous Week

Count({<VLN_Date = {"$(=Date(Max({1}VLN_Date) - 7, 'DD-MM-YYYY'))"}>} Description)

 

View solution in original post

3 Replies
sunny_talwar

Can you try this

Current Week

Count({<VLN_Date = {"$(=Date(Max({1}VLN_Date), 'DD-MM-YYYY'))"}>}Description)

Previous Week

Count({<VLN_Date = {"$(=Date(Max({1}VLN_Date) - 7, 'DD-MM-YYYY'))"}>} Description)

 

rubenmarin

Hi, how are you reading data from filename? maybe it's being loaded as a string , not a number (or date).

In this case you can try setting the input format with date#():
Date#(Left(Filebasename(), 10), 'DD-MM-YYYY') as VLN_Date

Change Left(Filebasename(), 10) with your current expression to extract date.
bobbydave
Creator III
Creator III
Author

Thanks Sunny.
Worked like a dream