Display working hours for the respective month and calculate with is and should

I would like to display the working hours for the various employees by month and calculate with actual and target.

Adding up all the values in a table is not the problem. I need this broken down into months.
And the months should also be distributed dynamically to tables.

Does anyone have an idea how I can implement it?

Very quick response would be to use the GROUP BY in your query. It should all be possible within the query itself.

Sounds good, but how do I do that?

You’re into query learning here but you could start with somewhere like this:

Sorting by date isn’t the problem either.

I would like to display the individual months and add up the hours from each month:
01/01/2023 - 5 hours
01/02/2023 - 5 hours

Altogether 10 hours

02/01/2023 - 7 hours
02/02/2023 - 7 hours

Altogether 14 hours

I found this Core Action “Group” but don’t know how to use it.

As @sitestreet suggested you have to use the GROUP BY clause on a query, the one you are using is to create an object [https://community.wappler.io/t/what-is-the-group-step-in- a-server-action/45967](https://community.wappler.io/t/what-is-the-group-step-in- a-server-action/45967)

what you have to do is

create a query in the backend

invoke the query on the front end

<dmx-serverconnect id="sc_get_date" url="/api/getdata"></dmx-serverconnect>

create a repeat and add the groupBY clause in this case you have to filter the month number with “getMonth”

<div dmx-repeat:repeat1="sc_get_date.data.query.data.groupBy(`date_start.getMonth(date_start)`)">

    // when you use the groupBy clause, remember that you must extract the values by always adding $value[0].name_of_your_db_field  
   // now you have to associate the month number with the month name to do this use a ternary operation like this

{{($value[0].date_start.getMonth(date_start) == 12 ? 'December' :     
$value[0].date_start.getMonth(date_start) == 11 ? 'November' : $value[0].date_start 
.getMonth(date_start) == 10 ? 'October' : $value[0].date_start.getMonth(date_start) == 9 ? 'September' 
: $value[0].date_start.getMonth(date_start)== 8 ? ' August' : $value[0].date_start.getMonth(date_start) 
== 7 ? 'July' : $value[0].date_start.getMonth(date_start) == 6 ? 'June' : $value[0].date_start 
.getMonth(date_start) == 5 ? 'May' : $value[0].date_start.getMonth(date_start) == 4 ? 'April' : 
$value[0].date_start.getMonth(date_start) == 3 ? ' March' : $value[0].date_start.getMonth(date_start) 
== 2 ? 'February' : $value[0].date_start.getMonth(date_start) == 1 ? 'January' : '') +' / ' + 

// add another repeat to display the data you need, in this case use the "where" clause,
// in this way you will be able to extract all the data according to the month

  <div dmx-repeat:repeat2="sc_get_date.data.data.query.data.where(`date_start.getMonth(date_start)`, 
  $value[0].date_start.getMonth(date_start), '==')">

this is the result you should get

January / 2023

February / 2023

hope it can help you