Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To ensure that your query can show data from multiple fiscal years, make sure you have included table joins on all financial fields required. 


Fields to Include in Queries that use Fiscal Year

TableFieldNotes







It is best to join tables in the following order if you need results for multiple fiscal years. If you do not do this, you may see duplicates in your results set.

...

finance_fund_types

expense_class


Restricting Your Query Results by Fiscal Year

There are 2 ways you can restrict your query results by fiscal year: including start and end dates that correspond to a given fiscal year, or using a fiscal year field. 

...

For instance, you can SELECT the fiscal_year_code field in your query with a join to the finance_fiscal_years table

SELECT      SELECT ffy.code AS expense_class_ fiscal_year_code,

FROM      FROM folio_reporting.finance_transaction_invoices AS fti 
           LEFT LEFT JOIN finance_fiscal_years AS ffy 
     ON       ON ffy.id = fti.transaction_fiscal_year_id

include a WHERE statement to include fiscal_year_code as a parameter, WHERE 

     WHERE ffy.code = (SELECT fiscal_year_code FROM parameters)

then include the parameter in your WITH statement at the top of the query to allow those running the query to restrict the results to fiscal year:

 /* Enter the fiscal year between the quotes below in FY#### format */
    WITH parameters AS (
    SELECT
        'FY2023'::VARCHAR AS fiscal_year_code
    )


    



Here is an example of a section of a report that includes all the fields required for fiscal year. 

...