cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
TCH
Level: Powered On

Filtering Flow

Hi there, 

I am in the middle of creating a flow that extracts data from a SP list, this in itself is relatively easy. 

However, I would now like to filter what data it extracts based on the date this was added, meaning  if it was added whithin a specific periode it should be extracted to one place, if it was added in a different period it should extract it to a different place. 

Eg. all data added to the SP list between the 21st and the 20th of two months should go to X location, and then a new period should start with the 21st to the 20th of the next months? so essentially create a "period" filter based on dates Smiley Happy 

Hope this makes sense, thanks in advance Smiley Happy 

- Tobi

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Filtering Flow

Hey @TCH 

 

Sure it's possible.

 

Here's the flow:

 

small-Screenshot 2019-09-19 at 11.58.48.png

small-Screenshot 2019-09-19 at 11.58.48.png

Regarding the formulas, let's get the 20th of last month. The first instinct is to get the number of the month and reduce it by one, but then you can run into issues (timezones, leap years, etc.). The best way to do this is to get the last month (using the formula for that), get the first day and add X days. Then you're always sure that you're calculating the correct date. With this in mind, here are the two formulas:

 

 

addDays(startOfMonth(subtractFromTime(utcNow(),1,'Month')),20)

and

 

 

addDays(startOfMonth(utcNow()),19)

Now it's just a question of comparing them and proceed with your flow.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

10 REPLIES 10

Re: Filtering Flow

Hi @TCH 

 

I think the easiest way is to do the following:

  1. Define the period(s) first. Is it easy to calculate it?
  2. Use a "case" to filter based on the periods.
  3. Do the actions that you need.

 

Here's a skeleton so that you understand what I mean. 

 

small-Screenshot 2019-09-17 at 15.23.30.png

 

The advantages of using the "compose" is that you can convert the data and always be sure you're calculating the period correctly. After that, use the cases to filter to each of your periods. 

 

Does this make sense? If I missed something, please provide some more information or examples of periods so that I can help you create the formulas.

 

Cheers!

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

 

Community Support Team
Community Support Team

Re: Filtering Flow

Hi @TCH ,

 

You should create flow as below:

1.png

And please create a "period" in the Condition then do something you want.

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

TCH
Level: Powered On

Re: Filtering Flow

@manuelstgomes 

I will definately try this out, I'll let you know if this fixes the issue 🙂 

- Cheers

TCH
Level: Powered On

Re: Filtering Flow

@v-alzhan-msft 

Hi Alice, Surely in this case i would have to manually add every single period, instead of being able to calculate the periods using a formulae of sorts, or is it because you have experience with this, and know that this works and the other method won't 🙂 

Appreciate the answer, cheers. 
- Tobi

Re: Filtering Flow

@TCH awesome!

If you need help along the way or get stuck just let me know.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

TCH
Level: Powered On

Re: Filtering Flow

@manuelstgomes  Perfect thanks, I will do 🙂 

TCH
Level: Powered On

Re: Filtering Flow

@manuelstgomes I am working away. 

However, i'm finding myself getting stuck when writing the equation. 

Essentially i am trying to say: Check if the date is between the 21st of last month and the 20th of this month; If yes, Return true and complete action, if not, Exit 🙂 

But I just can't seem to get this right, if it is even possible 🙂  

Re: Filtering Flow

Hey @TCH 

 

Sure it's possible.

 

Here's the flow:

 

small-Screenshot 2019-09-19 at 11.58.48.png

small-Screenshot 2019-09-19 at 11.58.48.png

Regarding the formulas, let's get the 20th of last month. The first instinct is to get the number of the month and reduce it by one, but then you can run into issues (timezones, leap years, etc.). The best way to do this is to get the last month (using the formula for that), get the first day and add X days. Then you're always sure that you're calculating the correct date. With this in mind, here are the two formulas:

 

 

addDays(startOfMonth(subtractFromTime(utcNow(),1,'Month')),20)

and

 

 

addDays(startOfMonth(utcNow()),19)

Now it's just a question of comparing them and proceed with your flow.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

TCH
Level: Powered On

Re: Filtering Flow

@manuelstgomes  

It works, praise the heavens. 

Had to work it a little bit as i was not the most consistent, but it works! 

Thank so much 🙂 

Re: Filtering Flow

Awesome!!!!! Well done!

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 137 members 4,952 guests
Please welcome our newest community members: