Possibility to display number of the week in report
Collapse
X
-
Tags: None
-
looking for similar, display the Sunday of that week
12/1/26
12/8/26
12/15/26
etc.Last edited by crmclients; 03-18-2026, 11:17 PM. -
Hi crmclients,
I've found a solution for your problem, however it does require the Advanced pack since it utilizes Workflows.
So basically my idea is as follows:
You create a technical field for the entity you want to group by the sundays of a week. This needs to be of the type date.
Then you create a workflow, that executes on any creation/update of the entity and then executes the following formula script:
In this example I used closeDate as the baseDate from where we want to get the sunday of the week.Code:$dayOfWeek = datetime\dayOfWeek(closeDate); if ($dayOfWeek == 0) { $dayOfWeek = 7; } cSundayOfTheWeekFIeld = datetime\addDays(closeDate, 7 - $dayOfWeek);
Now you got a technical field which always has the date of the sunday of the week from the date in closeDate. Now all you need to do is group the report by this new technical field.
The solution for the original problem (if still relevant since the post is from 2022... but maybe someone else needs the solution at some point):
it basically looks quite similar, that you create a technical field (just a integer type instead of date type since it needs to hold the value for the week-number) and then update this technical field via workflow which executes the following formula script:
Code:$first = string\concatenate(datetime\year(closeDate), '-01-01'); $offset = datetime\dayOfWeek($first) - 1; $diff = datetime\diff(closeDate, $first, 'days') + $offset; $week = number\floor($diff / 7) + 1;
Comment

Comment