An alternative approach may or may not be simpler depending on your level of PHP.
The most direct way is to use the WordPress filter posts_groupby (https://codex.wordpress.org/Plugin_API/Filter_Reference/posts_groupby).
It is not so commonly used or especially well documented, and if the official document above isn't sufficient to understand how to use it I suggest you search around for some tutorials or code examples.
It lets you directly manipulate the GROUP BY clause of the SQL query generated by WP_Query when retrieving posts (e.g. when using a View).
The filter will be triggered for each and every query. As well as the $groupby parameter that you will want to set and return, it also makes the $query object available so you can test that you are adding a $groupby clause for the target query.
It would be good practice to add the filter just before Views constructs the query in question and then remove it immediately afterwards, which you can do with the wpv_filter_query and wpv_filter_query_post_process hooks (hidden link).
You'll need to work out the details for your particular case, but as a starting point your code will want to look something like this:
function tssupp_add_groupby( $view_args, $view_settings, $view_id ){
if ( $view_id == 99 ) {
// add posts_groupby filter for this particular View
add_filter( 'posts_groupby', 'tssupp_groupby', 10, 2 );
}
return $view_args;
}
add_filter( 'wpv_filter_query', 'tssupp_add_groupby', 101, 3);
function tssupp_remove_groupby( $view_args, $view_settings, $view_id ){
if ( $view_id == 99 ) {
// remove posts_groupby filter for this View when done
remove_filter( 'posts_groupby', 'tssupp_groupby', 10, 2 );
}
return $view_args;
}
add_filter( 'wpv_filter_query_post_process', 'tssupp_remove_groupby', 101, 3);
function tssupp_groupby( $groupby, $query ){
error_log(print_r($query, true));
error_log(print_r($groupby, true));
return $groupby;
}
Note that in the posts_groupby filter I'm simply dumping the arguments to the log so you can see what is available to you.
If this doesn't make much sense you'll need to enlist the help of a developer—or persist with the solution of using multiple Views.