# Filtering by quarter

**URL:** <https://forum.bubble.io/t/filtering-by-quarter/5863>\
**Category:** Need help\
**Created:** [September 9, 2016, 11:12am UTC](https://forum.bubble.io/t/filtering-by-quarter/5863 "2016-09-09T11:12:43Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryanck](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@ryanck](https://forum.bubble.io/u/ryanck)\
**Post date:** [September 9, 2016, 11:12am UTC](https://forum.bubble.io/t/filtering-by-quarter/5863/1 "2016-09-09T11:12:44Z")

</div>

Hello everyone,

I was wondering how can I get results from a filtering based in the current quarter and the past quarter.

For example for the current quarter I´ll be showing data of the 3rd quarter since we are in September and for the past quarter I´ll be showing the data of the 2nd quarter of this year.

I´ve been playing with dates but cannot figure out yet how to do this.

Thanks a lot guys.

Have a good day.

---

<div class="post-metadata">

**Author:** ![andrewgassen](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/andrewgassen/32/44248_2.png) [@andrewgassen](https://forum.bubble.io/u/andrewgassen)\
**Post date:** [September 9, 2016, 11:29am UTC](https://forum.bubble.io/t/filtering-by-quarter/5863/2 "2016-09-09T11:29:23Z")

</div>

I’m sure there are many ways to do this, but the first thing that popped in my head is when you create the “thing” that existed in September, you would also have a field on that thing called “quarter.” You’d set the quarter equal to 3 if the date was September. Then, on your filter, you’d just have to filter by the thing’s quarter field.

Not sure what your specific use case is, but I think it’d work.

---

<div class="post-metadata">

**Author:** ![ryanck](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@ryanck](https://forum.bubble.io/u/ryanck)\
**Post date:** [September 9, 2016, 5:19pm UTC](https://forum.bubble.io/t/filtering-by-quarter/5863/3 "2016-09-09T17:19:39Z")

</div>

Hi @potentialthings,

I´ve tried that and it works. The problem now is that it has to be filtered by the current quarter and the past quarter.

Do you have any ideas? I´ve been thinking a lot about this but nothing.

Thanks a lot for your help.

---

<div class="post-metadata">

**Author:** ![andrewgassen](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/andrewgassen/32/44248_2.png) [@andrewgassen](https://forum.bubble.io/u/andrewgassen)\
**Post date:** [September 9, 2016, 5:42pm UTC](https://forum.bubble.io/t/filtering-by-quarter/5863/4 "2016-09-09T17:42:47Z")

</div>

Good question. I’ve struggled with getting “or” logic working in my apps, too. Unfortunately, I got nothin

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [September 9, 2016, 5:53pm UTC](https://forum.bubble.io/t/filtering-by-quarter/5863/5 "2016-09-09T17:53:12Z")

</div>

You could used the “merged” function in the search to combine last quarter and this quarter.

And the quarters can be controlled by looking up a record with the current date that has the quarters in them ?

---

<div class="post-metadata">

**Author:** ![ryanck](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@ryanck](https://forum.bubble.io/u/ryanck)\
**Post date:** [September 9, 2016, 6:00pm UTC](https://forum.bubble.io/t/filtering-by-quarter/5863/6 "2016-09-09T18:00:19Z")

</div>

Hi,

It´s like a Dashboard where you have the filters: current quarter and previous quarter. So when hitting on current quarter the box below will be showing the current quarter´s “net” “:sum” for example so the user can see the total of all the invoices net amount.

What do you think?

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [September 10, 2016, 6:44am UTC](https://forum.bubble.io/t/filtering-by-quarter/5863/7 "2016-09-10T06:44:21Z")

</div>

Ah, ok. yes, it is a little involved, and I struggled to make it any simpler.

So I filtered invoices where the invoice date is between two dates on the “Quarter” table.

![](https://us1.discourse-cdn.com/bubble/original/2X/b/be3fa187363fbfd45a60af3afb8468f4c29fd8c1.png)

And I chose the Quarter table that the current date is between quarter start and end.

![](https://us1.discourse-cdn.com/bubble/original/2X/9/9567ba589a9755bcdd5a4ab1fbf79d34af596db6.png)

So that table shows you the current quarter and the previous, and you can filter using those dates.

 ![](https://us1.discourse-cdn.com/bubble/original/2X/a/aa95f74310de16ffc0eed5e1637d969e38af8f8d.png)

---

<div class="post-metadata">

**Author:** ![ryanck](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@ryanck](https://forum.bubble.io/u/ryanck)\
**Post date:** [September 10, 2016, 9:10am UTC](https://forum.bubble.io/t/filtering-by-quarter/5863/8 "2016-09-10T09:10:26Z")

</div>

Wow, nice one.

I´m still figuring out how you got that. I´m getting a little bit lost about it.

So you created a new “type of thing” on the database named “quarters” and then you set the quarter start and the quarter end, right?

But what about setting the quarter right in the invoices as “Q1”, “Q2”, … ?

Could you explain me a little bit?

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [September 11, 2016, 6:36am UTC](https://forum.bubble.io/t/filtering-by-quarter/5863/9 "2016-09-11T06:36:11Z")

</div>

Yes, that is another way of doing it. Set the Quarter by extracting month, and if it is 1,2,3 set Q1 etc.

But you will end up, I think, doing pretty much the same thing in terms of working out what Quarter you are in, and what the last quarter was.

---

<div class="post-metadata">

**Author:** ![ryanck](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@ryanck](https://forum.bubble.io/u/ryanck)\
**Post date:** [September 12, 2016, 5:20pm UTC](https://forum.bubble.io/t/filtering-by-quarter/5863/10 "2016-09-12T17:20:04Z")

</div>

Thanks a lot @NigelG

I´ll try my best to achieve it.

---

<div class="post-metadata">

**Author:** ![NigelG](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NigelG](https://forum.bubble.io/u/NigelG)\
**Post date:** [September 13, 2016, 5:40am UTC](https://forum.bubble.io/t/filtering-by-quarter/5863/11 "2016-09-13T05:40:43Z")

</div>

It is one of those things that seems like it should be easier than it really is.

---

<div class="post-metadata">

**Author:** ![ryanck](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@ryanck](https://forum.bubble.io/u/ryanck)\
**Post date:** [September 13, 2016, 9:25am UTC](https://forum.bubble.io/t/filtering-by-quarter/5863/12 "2016-09-13T09:25:43Z")

</div>

You´re so right. It´s like oh current quarter and last quarter, then you try to get the computer to do that and it gets so difficult. Hehe

Thanks a lot Nigel.
