Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
fanninam
Creator
Creator

Minus 30 work days

I created the following variable:  v30DaysOld = Date((Today()-30))

It does calculate 30 days earlier but I want it to calculate 30 work days earlier.

I do have a Field called "DAY_TYPE" that includes WorkDay, Holiday, Off_Friday and Weekend.

So I have been trying this on my variable:  v30DaysOld = ({$<DAY_TYPE={'WorkDay'}>}Date(Today()))-($<DAY_TYPE={'WorkDay'}>}30)

I know I am doing something wrong here.  Can anyone give me some guidance on how I can write this statement properly so that my variable will only minus 30 work days instead of minus 30 days?

4 Replies
vishsaggi
Champion III
Champion III

May be Try this?

LET v30DaysOld = Only( {$< DAY_TYPE = {'WorkDay'}>} Date(Today()) ) - 30 ;

sunny_talwar

May be use FirstWorkDate() or LastWorkDay() function here

firstworkdate ‒ QlikView

lastworkdate ‒ QlikView

sasiparupudi1
Master III
Master III

Hi Amber

Please share your calendar or date fields.

The set analysis on constant like 30 does not work

And there is nothing to filter when you select today ()

Regards

Sasi

omkarvamsi
Creator
Creator

Please try as below;

1)write below let statement in script editor.

         let vToday=today();

2)run the script

3)take a text box and try the below expression:

          =makedate(year(today()),month(AddMonths(today(),-1)),(day(vToday)-30)*(-1))