Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
locky
Contributor
Contributor

Variables not working - 4 week period Mon-Fri

Hi

I have a set analysis that I am preparing for a dashboard - I need to get the past four week period from Monday to Friday (not from the current day). 

I have the formula: 

count({<[SCHEDULE DATE] = {">=$(vLast4WeeksStart)<=$(vLast4WeeksEnd)"},DimSG = {'SS'}>}URN)

using the below variables.


vLast4WeeksEnd
=date(
if(weekday(Now())='Mon.', now()-1,
if(weekday(Now())='Tue.', now()-2,
if(weekday(Now())='Wed.', now()-3,
if(weekday(Now())='Thu.', now()-4,
if(weekday(Now())='Fri.', now()-5,
if(weekday(Now())='Sat.', now()-6,
if(weekday(Now())='Sun.', now()-7,'Error'))))))),'DD/MM/YYYY')

vLast4WeeksStart
=date(
if(weekday(Now())='Mon.', now()-28,
if(weekday(Now())='Tue.', now()-29,
if(weekday(Now())='Wed.', now()-30,
if(weekday(Now())='Thu.', now()-31,
if(weekday(Now())='Fri.', now()-32,
if(weekday(Now())='Sat.', now()-33,
if(weekday(Now())='Sun.', now()-34,'Error'))))))),'DD/MM/YYYY')

But this doesn't seem to be working - can someone please advise where I have gone wrong?  When I take out the variable part, the rest of the formula is working.

Thanks

0 Replies