@dobroo
Thank you...much clearer!
I had to make some assumptions on your data types, so I leaned toward text/strings for all of the records. That can be adjusted.
Using your data, the following formula on a Gallery Items property produces the results seen below:
With({_items:
Table(
{Ressource:"R1", StartDate:"01.01.2021", EndDate:"01.01.2021", StartTime:"10:00", EndTime:"12:00"},
{Ressource:"R1", StartDate:"01.01.2021", EndDate:"02.01.2021", StartTime:"12:00", EndTime:"13:00"},
{Ressource:"R1", StartDate:"01.01.2021", EndDate:"01.01.2021", StartTime:"09:00", EndTime:"10:00"},
{Ressource:"R1", StartDate:"01.01.2021", EndDate:"01.01.2021", StartTime:"16:00", EndTime:"17:00"},
{Ressource:"R2", StartDate:"01.01.2021", EndDate:"01.01.2021", StartTime:"10:00", EndTime:"12:00"},
{Ressource:"R2", StartDate:"01.01.2021", EndDate:"02.01.2021", StartTime:"12:00", EndTime:"13:00"},
{Ressource:"R2", StartDate:"01.01.2021", EndDate:"01.01.2021", StartTime:"09:00", EndTime:"10:00"},
{Ressource:"R2", StartDate:"01.01.2021", EndDate:"01.01.2021", StartTime:"16:00", EndTime:"17:00"}
)
},
Ungroup(
AddColumns(
GroupBy(
_items,
"Ressource", "StartDate", "_records"
),
"_index", With({_rows: Sort(AddColumns(_records, "_t", TimeValue(StartTime)), _t)}, ForAll(Sequence(CountRows(_rows)), Patch(Last(FirstN(_rows, Value)), {Index:Value})))
),
"_index"
)
)
Result:
