How to convert a string to minutes to sum following a split

Data

Timer:: 09:00 | 15 | ligne 1
Timer:: 10:00 | 30 | ligne 2

Query 1 → list of duration

TABLE WITHOUT ID
      Duree AS "Durée"
WHERE Timer != null
where file.name = this.file.name
FLATTEN Timer AS OneTime
WHERE OneTime
FLATTEN split(OneTime, "\s+\|\s+")[1] AS Duree

The result is OK

image

I’m trying to parse string to minutes for sum

TABLE WITHOUT ID
	  Num AS T1,
	  (round(sum(rows.Num), 2)) AS T2,
	  Dura AS T3,
	  (round(sum(rows.Dura), 2)) AS T4,
	  T5,
	  T6
WHERE Timer != null
where file.name = this.file.name

FLATTEN Timer AS OneTime
WHERE OneTime
FLATTEN split(OneTime, "\s+\|\s+")[1] AS Duree
FLATTEN number(Duree) AS Num
FLATTEN dur(Duree) AS Dura
FLATTEN Num.minutes AS T5
FLATTEN typeof(Duree) = "minutes" AS T6

But the result is

I also tried totaling by converting to duration

table
sum(filter(sum(rows.duration), (t) => t)) AS Tot1
WHERE Timer != null
WHERE file.name = this.file.name
FLATTEN Timer AS OneTime
WHERE OneTime
FLATTEN dur(split(OneTime, "\s+\|\s+")[1]) AS duration
group by duration

but I can’t get the sum of time

You might like to have a look here:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.