Possibility to display number of the week in report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jakub Grufik
    Senior Member
    • Aug 2022
    • 361

    #1

    Possibility to display number of the week in report

    Hello,

    I made some reports where I am using "Group By" week. However, in the report(chart), it is displayed as 2022/1, 2022/2 etc.

    Is there any way to display just the number of the week instead of the year+number of the week?

    Thanks a lot in advance!
  • crmclients
    Senior Member
    • Jul 2020
    • 331

    #2
    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.

    Comment

    • robin
      Junior Member
      • Aug 2025
      • 14

      #3
      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:

      Code:
      $dayOfWeek = datetime\dayOfWeek(closeDate);
      if ($dayOfWeek == 0) {
          $dayOfWeek = 7;
      }
      cSundayOfTheWeekFIeld = datetime\addDays(closeDate, 7 - $dayOfWeek);
      In this example I used closeDate as the baseDate from where we want to get the sunday of the week.

      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

      Working...