Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
venkey2847
Contributor II
Contributor II

current day vs previous day expressions

Hi All,

I need to have two expressions  one is for current day sale and other is for previous day sales for that particular company,here current day is latest date for respective company.

The problem here is when company is having sales on Monday then current day is Monday and previous day is Friday. Need to excludes weekend dates from the previous day expression.

For Current day i have used below expression it is working as expected.

sum({<Business date={"$(=(max(Business date)))"}>} [St amt])

But for previous day expression i am not getting, please help me out this issue.

i have attached excel file for sample data.

Thanks in advance.

 

Regards,

Venkey

 

 

 

 

 

 

Labels (3)
3 Replies
ramasaisaksoft

WeekDay() ,WorkDate()will help you in this situation.

 

Simply use FirstWorkDate() for this

 

=If(WeekDay(Today()) = 'Sun' OR WeekDay(Today()) = 'Sat', firstworkdate (Today(), 1), firstworkdate (Today(), 2) )

 

From Qlikview Help file:

 

firstworkdate(end_date, no_of_workdays {, holiday} )

Returns the latest starting date to achieve number_of_workdays (Monday-Friday) ending no later than end_date taking into account any optionally listed holidays. End_date and holiday should be valid dates or timestamps.

Examples:

firstworkdate ('2007-03-01', 9) returns '2007-02-19' 

firstworkdate ('2006-12-31', 8, '2006-12-25', '2006-12-26') returns '2006-12-18' 

 

                                                     else

 

If(WeekDay(Today()) = 'Sun', Date(Today() - 2), Date(Today() - 1)))

Akshada
Partner - Contributor III
Partner - Contributor III

venkey2847
Contributor II
Contributor II
Author

HI Thanks for quick reply.

I want do it in set expression.

 

regards,

venkey