Power Apps Filter Gallery By Quarter [With Examples]

Do you know how to filter a Power Apps gallery by quarter? No worries!

This Power Apps tutorial explains everything about the Power Apps filter gallery by Quarter, like:

  • How to filter the Power Apps gallery by the current quarter
  • Filter Power Apps gallery by next quarter
  • Working with Power Apps filter gallery by the next ‘N’ quarters
  • How to filter Power Apps gallery by last quarter
  • Power Apps filter gallery by previous ‘N’ quarters

Power Apps Filter Gallery By Quarter [Current Quarter]

Here, I will show you how to filter a Power Apps gallery by the current quarter.

Example:

  • I have a SharePoint Online List, i.e., [Employee Onboarding]. This list contains the below fields.
Column NameData Type
Employee IDThis is a Title column with a single line of text. I just renamed it to “Employee ID”
Employee NameA single line of text
EmailSingle line of text
Joinining DateDate and time
Power Apps Filter Gallery By Quarter
  • In Power Apps, there is a Gallery control. This gallery displays each record from the SharePoint list based on the current quarter.
Power Apps Filter Gallery By Current Quarter

To achieve the above example, follow the below-mentioned steps. Such as:

  • Open Power Apps with your respective Microsoft credentials -> Create Power Apps canvas app -> Connect the SharePoint list to the app. Once you connect, it will look like the screenshot below.
Power Apps Filter Gallery By This Quarter
  • Insert a Gallery control [gal_CurrentQuartersRecords] and set its Items property as:
Items = With(
    {
        StartDate: Date(
            Year(Today()),
            Month(Today())
            -If(
                Mod(Month(Today())-1,3) = 0,
                0,
                Mod( Month(Today())-1, 3)
            ),
            1
        ),
        EndDate: Date(
            Year(Today()),
            Month(Today()) + 3-Mod(Month(Today())-1,3),
            1
        )-1
    },
    Filter(
        'Employee Onboarding',
        'Joining Date' >= StartDate,
        'Joining Date' <= EndDate
    )
)

Where,

  1. With() = This function can help us to evaluate a formula for a single record
  2. StartDate, EndDate = Power Apps Scope Variables
  3. Year(Today()) = This function returns the year component of a Date/Time value
  4. Month(Today()) = This function returns the month component of a Date/Time value
  5. Mod(Month(Today())-1,3) = This function helps us to find the date value from the respective month component
  6. ‘Employee Onboarding’ = SharePoint Online List
  7. ‘Joining Date’ = SharePoint Date field Column
How to Filter Power Apps Gallery By Current Quarter
  • SavePublish, and Preview the app. The gallery will display the filtered records, i.e., [This Quarter Records] as in the screenshot below.
Power Apps Gallery Filter By Current Quarter

This is how to filter a Power Apps gallery by the current quarter.

Power Apps Filter Gallery By Next Quarter

Next, we will see how to filter a Power Apps gallery by next quarter.

Example:

  • I will also take the same SharePoint Online list [Employee Onboarding] for this example.
  • In Power Apps, there is a Vertical gallery control. This gallery displays each record from the SharePoint list based on the next or upcoming quarter.
Power Apps Filter Gallery By Next Quarter

To work around this example, follow the below steps.

  • On the Power Apps Screen -> Insert a Gallery control and set its Items property as:
Items = With(
    {
        StartDate: Date(
            Year(Today()),
            Month(Today())
            -If(
                Mod(Month(Today())-1,3) = 0,
                0,
                Mod( Month(Today())-1, 3)
            )+3,
            1
        ),
        EndDate: Date(
            Year(Today()),
            Month(Today()) + 3-Mod(Month(Today())-1,3)+3,
            1
        )-1
    },
    Filter(
        'Employee Onboarding',
        'Joining Date' >= StartDate,
        'Joining Date' <= EndDate
    )
)

Where,

  1. Mod( Month(Today())-1, 3))+3 = This function helps us to find the date value from the respective month component, and ‘+3’ is for the next quarter

Refer to the image below:

Power Apps Filter Gallery By Upcoming Quarter
  • Save, Publish, and Preview the app. The gallery will display the filtered records, i.e., [Next Quarter Records] like below.
Power Apps Gallery Filter By Next Quarter

This is how we can filter a Power Apps gallery by the next/upcoming quarter.

Power Apps Filter Gallery By Next ‘N’ Quarters

Let’s see how to filter the Power Apps gallery by the next ‘N’ quarters.

Example:

  • I will take the same SharePoint Online list [Employee Onboarding] for this example.
  • In Power Apps, there is a Vertical Gallery control. This gallery filters and displays each record from the SharePoint list based on the next/upcoming three quarters.
Power Apps Filter Gallery By Next 'N' Quarters

To do so, follow the below-mentioned steps. Such as:

  • On the Power Apps Screen -> Insert a Gallery control and set its Items property to the code below.
Items = With(
    {
        FirstDate: Date(
            Year(Today()),
            Month(Today()),
            Day(Today())
        ),
        LastDate: Date(
            Year(Today()),
            Month(Today()) + (3 * 3),       // You can also change the number of Quarters
            Day(Today())
        ) - 1
    },
    Filter(
        'Employee Onboarding',
        'Joining Date' >= FirstDate,
        'Joining Date' <= LastDate
    )
)

Where,

  1. Month(Today()) + (3 * 3) = This function helps us to find the date value from the respective month component. And 3 is the current quarter, and ‘3’ means number of quarters
  2. Day(Today()) = Power Apps Day() function returns the day component of a Date/Time value

Refer to the below screenshot:

Power Apps Filter Gallery By Upcoming 'N' Quarters
  • Save, Publish, and Preview the app. The gallery will display the filtered records, i.e., [Next 3 Quarters Records], as shown below.
Power Apps Gallery Filter By Next 'N' Quarters

This is all about the Power Apps filter gallery by the next/upcoming ‘N’ quarters.

Power Apps Filter Gallery By Previous Quarter

Similarly, here we will see how to filter a Power Apps gallery by the previous quarter.

Example:

  • I will take the same above SharePoint Online list [Employee Onboarding] for this example.
  • In Power Apps, there is a Horizontal gallery control. This gallery displays each record from the SharePoint list based on the last or previous quarter.
Power Apps Filter Gallery By Previous Quarter

To work around the above example, follow the below steps.

  • On the Power Apps Screen -> Insert a Gallery control and set its Items property as:
Items = With(
    {
        StartDate: Date(
            Year(Today()),
            Month(Today())
            -If(
                Mod(Month(Today())-1,3) = 0,
                0,
                Mod( Month(Today())-1, 3)
            )-3,
            1
        ),
        EndDate: Date(
            Year(Today()),
            Month(Today()) + 3-Mod(Month(Today())-1,3)-3,
            1
        )-1
    },
    Filter(
        'Employee Onboarding',
        'Joining Date' >= StartDate,
        'Joining Date' <= EndDate
    )
)

Where,

  1. Month(Today()) + 3-Mod(Month(Today())-1,3)-3 = This function helps us to find the date value from the respective month component and ‘-3’ is the number of previous quarters

Refer to the below screenshot:

Power Apps Filter Gallery By Last Quarter
  • Save, Publish, and Preview the app. The gallery will display the filtered records, i.e., [Last Quarter Records] as in the screenshot below.
Power Apps Gallery Filter By Previous Quarter

This is how to filter a Power Apps gallery by the previous quarter.

Power Apps Filter Gallery By Previous ‘N’ Quarters

Finally, I will show you how to filter a Power Apps gallery by previous ‘N’ quarters.

Example:

  • I will also take the same SharePoint Online list [Employee Onboarding] for this example.
  • In Power Apps, there is a Gallery control. This gallery displays each record from the SharePoint list based on the last/previous two quarters.
Power Apps Filter Gallery By Previous 'N' Quarters

To achieve it, follow the below steps. Such as:

  • On the Power Apps Screen -> Insert a Gallery control and set its Items property code like below.
Items = With(
    {
        StartDate: Date(
            Year(Today()),
            Month(Today())-(3*2),       // You can also change the number of Quarters
            Day(Today())
        )+1,
        EndDate: Date(
            Year(Today()),
            Month(Today()), 
            Day(Today())
        )
    },
    Filter(
        'Employee Onboarding',
        'Joining Date' >= StartDate,
        'Joining Date' <= EndDate
    )
)

Where,

  1. Month(Today())-(3*2) = This function helps us to find the date value from the respective month component. 3 is the current quarter, and 2 means the number of quarters
Power Apps Filter Gallery By Last 'N' Quarters
  • Save, Publish, and Preview the app. The gallery will display the filtered records, i.e., [Last Two Quarters Records] as shown below.
Power Apps Filter Gallery By Previous 'N' Quarters

This is how to filter a Power Apps gallery by previous/last ‘N’ quarters.

Conclusion

I have explained in detail the Power Apps filter gallery by Quarter.

I have also discussed the Power Apps filter gallery by the current quarter and how to filter a Power Apps gallery by the last quarter.

In the last, I have covered the Power Apps gallery by the next ‘N’ quarters and how to filter a Power Apps gallery by the previous ‘N’ quarters.

Also, you may like some more Power Apps tutorials: