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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum Weekend and Weekday?

Hi all,

anyone know how to set summary values for weekend (saturday & sunday) and weekday (monday till friday) for every week. so i want to know summary value (for example: sales) in this this week, which I separate the summary into weekend and weekday.

thanks before

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

You can use the WeekDay() function in your script, in the same place where you have the date field, and create a new flag field

If(WeekDay(DateField) > 0 AND WeekDay(DateField)<6, 1, 0) AS WorkDay

To get the sales on weekends

Sum({< WorkDay = {0} >} Sales)

And to get the sales on normal days, same expression but 1 instead of 0

Sum({< WorkDay = {1} >} Sales)

Hope that helps.

Miguel

View solution in original post

2 Replies
Miguel_Angel_Baeyens

Hi,

You can use the WeekDay() function in your script, in the same place where you have the date field, and create a new flag field

If(WeekDay(DateField) > 0 AND WeekDay(DateField)&lt;6, 1, 0) AS WorkDay

To get the sales on weekends

Sum({< WorkDay = {0} >} Sales)

And to get the sales on normal days, same expression but 1 instead of 0

Sum({< WorkDay = {1} >} Sales)

Hope that helps.

Miguel

Not applicable
Author

thanks miguel for your help, and it work now, but with a bit modification:

If(WeekDay(OrderDate) > 0 AND WeekDay(OrderDate)>=5,1,0) AS WorkDay

so, i use this expression : Sum({< WorkDay = {0} >} Sales) for workday, and Sum({< WorkDay = {0} >} Sales) for weekend.

thanks