Hi PA users!
I've been working on it but can not find a solution yet..
Requirement-
The user can choose the start and end date from 2 date pickers in power apps,
user can either choose minimum from 1 week(ex. Thursday 30/09/2021- Wednesday 06/10/2021), 7 days per unit;
or user can choose per month (ex. 01/09/2021-30/09/2021, or 03/09/2021- 02/11/2021, ..) ,
the maximum duration is 4 months.
Now the case is-
I need to record the duration either 'by month(s)' OR 'by week(s)' into a excel column:
ex. if the user choose Thursday 30/09/2021- Wednesday 06/10/2021 , then the it should be recorded as '1' in the excel 'week' column. If the user choose 03/09/2021- 02/11/2021, then the it should be recorded as '2' in the excel 'month' column.
I tried the solution by using DateDiff( ) function, count the user chosen duration by days, then divided by 7 in the power automate to record the duration only by week(s), but can not find a solution to distinguish whether the user choose by weeks or by month, mainly because there could be 28 days in Feb. and it can be 4 weeks as well if the user choose from the other months.
I don't want to add the control in PA, requesting user indicate whether they choose by month or by weeks.
Searching for solution from power automate expressions...
Does any one have any advices?
many thanks in advance!
PA user