Hi now came up with this solution:
Set(
varMonthsDiff,
DateDiff(
dtpStartDate.SelectedDate,
dtpEndDate.SelectedDate,
Months
)
);
Clear(MyDateTable);
ForAll(
Sequence(varMonthsDiff + 1),
Collect(
MyDateTable,
{
CurrentSequenz: CountRows(MyDateTable),
StartDate: dtpStartDate.SelectedDate,
EndDate: dtpEndDate.SelectedDate,
FirstDayOfMonth: Date(
Year(
DateAdd(
dtpStartDate.SelectedDate,
CountRows(MyDateTable),
Months
)
),
Month(
DateAdd(
dtpStartDate.SelectedDate,
CountRows(MyDateTable),
Months
)
),
1
),
LastDayOfMonth: Date(
Year(
DateAdd(
dtpStartDate.SelectedDate,
CountRows(MyDateTable),
Months
)
),
Month(
DateAdd(
dtpStartDate.SelectedDate,
CountRows(MyDateTable),
Months
)
) + 1,
0
)
}
)
);
ClearCollect(
MyDateTable2,
AddColumns(
MyDateTable,
"DaysInMonth",
DateDiff(
FirstDayOfMonth,
LastDayOfMonth
) + 1,
"MonthCounter",If(EndDate > LastDayOfMonth,1,RoundUp((1/(DateDiff(
FirstDayOfMonth,
LastDayOfMonth
) + 1))*(DateDiff(FirstDayOfMonth,EndDate,Days)+1),2))
)
)
Might not be the cleanest solution biut seems to be working.