Time Spent group by year

This example is done with Tempo Structure.

1)

workLogs.MAP(x ->
  CONCAT(
    YEAR(x.startDate),
    '-',
    REPLACE(MONTH(x.startDate), '/^(\d)$/', '0$1'),
    ' ',
    x.author.displayName))

2)

item.MAP(x -> SUBSTRING(x, 1, 8))

3)

item.MAP(x -> SUBSTRING(x, 1, 5))

WITH group_str = PARENT#level=3 { summary }:
workLogs
  .FILTER(x ->
    CONCAT(
      YEAR(x.startDate),
      '-',
      REPLACE(MONTH(x.startDate), '/^(\d)$/', '0$1'),
      ' ',
      x.author.displayName
    ) = group_str)
  .timeSpent
  .SUM()

WITH group_str = PARENT#level=3 { summary }:
WITH all = history
  .MAP(ARRAY($.time, $.changes.FILTER(change -> change.field = "Status").FIRST()))
  .FILTER(SIZE($.GET(1)) > 0)
  .SORT_BY($.GET(0)):
WITH status_at_time(at_time) =
  IF at_time < TRUNCATE_TO_MINUTES(all.FIRST().GET(0)): all.FIRST().GET(1).from
  ELSE IF all.ANY(TRUNCATE_TO_MINUTES($.GET(0)) = at_time):
    all.FILTER(TRUNCATE_TO_MINUTES($.GET(0)) = at_time).MAP(ARRAY($.GET(1).from, $.GET(1).to))
  ELSE all.FILTER(TRUNCATE_TO_MINUTES($.GET(0)) < at_time).LAST().GET(1).to:
WITH filtered_by_group = workLogs
  .FILTER(x ->
    CONCAT(
      YEAR(x.startDate),
      '-',
      REPLACE(MONTH(x.startDate), '/^(\d)$/', '0$1'),
      ' ',
      x.author.displayName
    ) = group_str):
filtered_by_group
  .FILTER(x -> status_at_time(x.startDate).FLATTEN().ANY(x -> x = "In Progress"))
  .timeSpent
  .SUM()

Reach out to me for professional support!

Contact