Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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:-
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.
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)
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.
Could you please help ?
I also checked the values of the variables in the KPI.
It seems fine , don't know why it is coming blank on the expression.
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)
I tried and it is giving me the value for one particular date range like below :-
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