Sometimes we need to calculate a list of dates in Power Automate workflows to for example generate a Planner task for each date in the list and assign it to a team member, or to generate a Teams meeting for each date in the list.
There are many uses cases where a list of dates is useful in Power Automate, and this can be achieved through different approaches. In this blog, we will show how to use a combination of Power Fx and the Select action we can create a simple but effective workflow that generates a list of sequential dates.
Step by step walkthrough
First, let’s navigate to the Power Automate portal (https://make.powerautomate.com) and navigate to the solution where our flow will be used in.
Create instant flow
Let’s create a new instant flow and add two input parameters of date type:
- Start Date
- End Date
- The final result should look like this:
Add compose action to calculate date difference
Next, let’s calculate the difference between the two date parameters. For that, we can use the “DateDifference” Power Fx formula.
Let’s add a compose action in the workflow and add this formula:
@{dateDifference(triggerBody()?['date'],triggerBody()?['date_1'])}
If there is more than one day in between the two dates, the result will look like this:
If the start and end dates are the same it will look as follows:
Use select action to generate list of dates
Now that we know how many days we have in between the two dates, we can use the “Select” action to generate the list of dates.
For that we will do the following:
- Use the range formula to create an array between 0 and the number of days in between the dates
- Add 1 to the range formula
- If the start and end dates are the same, just generate the first date as list
- If more than one day is in between, add it to the range
Above will result in a formula that looks like this:
range(
0,
add(
1,
if(
equals(
outputs(
'Date_Difference'
),
'00:00:00'
),
0,
int(
first(
split(
outputs(
'Date_Difference'
),
'.'
)
)
)
)
)
)
Above should be placed in the “from” of the select action
If we are generating a list between 2025-12-20 and 2025-12-25, the range function would return [0,1,2,3,4,5].
Now, in the “Map” parameter we need to add the 0,1,2,3,4 and 5 days to 2025-12-20. To do this, we need to use the “addDays” function
addDays(triggerBody()?['date'],item())
H3: End result
This is how the end workflow will look
Now we are ready for testing!
Testing
Multiple dates test
Single date test
Start Date: 2025-12-26
End Date: 2025-12-26
How our Power Automate consulting services can help
Using our Power Automate consulting services, we have built many simple and complex workflows for our clients, making the most of all the Power Automate actions and Power Fx functions.
Contact us, we’ll be more than happy to have a conversation and see how we can be of help to your team.
