Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Aspiring_Developer
Specialist
Specialist

WTD in qliksense

Hello All,

I am trying to calculate WTD where my week start date should correspond to Sunday and week end date should be Monday.

In the script , I have changed below:-

SET FirstWeekDay=6; // changed from 0 to 1 Vb test
SET BrokenWeeks=0;

Now I have proper week start and week end dates as follow:-

Aspiring_Developer_0-1658216573846.png

 

Here week start dates are for Sunday's and week end is Monday.

Now , what I want to show is a table with dimension as Date (only for Saturday i.e date corresponding to Saturday only ) and in measure, cumulative sum of entire week. (WTD- sum of numbers starting from sunday and ending at Monday). I tried using below expression but it did not worked:-

Sum({< Date_key={">=$(=Num(WeekStart(Max(Date_key))))<=$(=Num(WeekStart(Max(Date_key))))"}>} total_logged)

 

Can anyone please help ? 

 

Just to add, I have other dates as well in my data model and in few charts  I am displaying only Saturday dates as dimension in the visual. So, when I changed the value of set Firstdayofweek from 0 to 6 , it disturbed the other dates in the data model.

 

@OmarBenSalem @tresesco @Henric_Cronström

Labels (1)
5 Replies
MayilVahanan

Hi

Try like below

Hope its Sunday to Saturday not Monday.

(WTD- sum of numbers starting from sunday and ending at Saturday)

For only one chart you want to calculate from Sunday to Saturday, you can change in front end like below.

Sum({< Date_key={">=$(=Num(WeekStart(Max(Date_key),0,6)))<=$(=Num(WeekEnd(Max(Date_key),0,6))))"}>} total_logged)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Aspiring_Developer
Specialist
Specialist
Author

Hi @MayilVahanan 

Yes , you are correct. The week start day should be Sunday and week end day should be Saturday.

I tried the above expression. However, it didn't worked.

Aspiring_Developer_0-1658220800600.png

Could you please help ?

Aspiring_Developer
Specialist
Specialist
Author

I also checked the values of the variables in the KPI. 

Aspiring_Developer_1-1658220971730.png

 

It seems fine , don't know why it is coming blank on the expression.

MayilVahanan

Hi

Its Date_key is number format or date format, if its date, can you change like below with ur dateformat

Sum({< Date_key={">=$(=Date(WeekStart(Max(Date_key),0,6)))<=$(=Date(WeekEnd(Max(Date_key),0,6))))"}>} total_logged)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Aspiring_Developer
Specialist
Specialist
Author

I tried and it is giving me the value for one particular date range like below :-

Aspiring_Developer_0-1658222138562.png

I need to achieve it for all dates.

Date_key will be my dimension and in that it should display only Saturday dates and show cumulative sum of that week . For example :-

Date_Key 

16/07/2022  

Now against this date it should the sum for all valuelues starting from 10 th july -sunday till 16 july -saturday

@Vegar