Group sql data and sum total

I need help is there an easy way to group by class and add the total_time.
This is my current expression to get the resulting SQL table below

leftJoin(
  {value},
  {[default]New Tag},
  it()['Reason_id'],
  it()['Reason_id']
)

image

I made your given expression a tag, then created another expression to do the grouping. Feel free to combine them into one expression if you'd like.

I was able to write this from an example in the thread that Phil linked to in your original thread.

forEach(
	groupBy({[default]Testing/Dataset},it()['classification']),
	asMap(
		'classification',it()[0],
		'TotalMinutes', sum(it()[1],'TotalMinutes')
	) 
)
1 Like

Thank you so much, that worked way simpler than the way I was trying to go about it

1 Like