How to Define Fiscal Year in Power BI

A fiscal year is a designated 12-month period used by companies for financial reporting. The fiscal year differs from the calendar year (January 1 to December 31), and comprehending the concept is crucial for precise reporting, forecasting, and analysis.

Defining the fiscal year in Power BI involves establishing a customized, non-calendar year period that aligns with a company’s financial cycles. This allows you to analyze data based on your unique fiscal calendar.

By tailoring the temporal perspective to suit the specific needs of a going concern, Power BI empowers you to gain deeper insights and make data-driven decisions that drive sustainable growth and profitability.

This post will guide you through the step-by-step process of creating a fiscal year calendar in Power BI. The steps involved in creating a fiscal year are outlined in the following sections.

Step 1: Create a Date Table

To establish a fiscal year, your initial step involves creating a date table.

In Power BI, you can accomplish this using either Power Query or DAX. Yet, when it comes to delineating a fiscal year, opting for DAX presents a more effective avenue, particularly if your proficiency with the M language is not extensive.

Date Table = 
    VAR MinYear = YEAR ( DATE ( 2022, 01, 06 ) )
    VAR MaxYear = YEAR ( TODAY() )
RETURN
    ADDCOLUMNS (
        FILTER (
            CALENDAR (
            DATE ( MinYear, 01, 01 ),
            TODAY()            
            ),
            AND (
                YEAR ( [Date] ) >= MinYear, 
                YEAR ( [Date] ) <= MaxYear
            )
        ),
        "Year", YEAR ( [Date] ),
        "Month", MONTH ( [Date] ),
        "WeekNum", WEEKNUM ( [Date] )
    )

This DAX query will create a date table with four columns namely, Date, Year, Month, and WeekNum. These columns will carry values corresponding to the traditional date cycles. It’s from these columns that you can now begin to define a fiscal period as it aligns with your requirements.

The breakdown of the DAX statements is as follows.

1. Date Table – This defines the name of the calculated table that will be created.

2. VAR MinYear = YEAR ( DATE ( 2022, 01, 06 ) ) – Here, a DAX variable named MinYear is created to store the year value extracted from the date January 6, 2022.

3. VAR MaxYear = YEAR ( TODAY() ) – Similarly, a DAX variable named MaxYear is established to store the current year extracted from the system’s current date (TODAY() function.

4. RETURN – This indicates the start of the expression to be returned for the calculated table.

  • ADDCOLUMNS ( – The ADDCOLUMNS function is used to create a new table by adding calculated columns to an existing table.
  • FILTER ( – This function filters a table based on a condition.
  • CALENDAR ( DATE ( MinYear, 01, 01 ), TODAY() ): The CALENDAR function generates a table of dates between January 1 of MinYear and the current date (TODAY()).
  • AND ( – This function combines multiple conditions using the logical AND operator.

5. YEAR ( [Date] ) >= MinYear, YEAR ( [Date] ) <= MaxYear – These conditions ensure that the dates within the generated calendar table fall within the range of MinYear and MaxYear.

6. "Year", YEAR ( [Date] ), "Month", MONTH ( [Date] ), "WeekNum", WEEKNUM ( [Date] ) – These are the calculated columns being added to the new table. They include the year, month, and week number extracted from the Date column of the calendar table.

When you enter the DAX statement, the Date Table will be created as in the image above.

Step 2: Add a Fiscal Year Column to the Dates Table

After the first step, add a new Fiscal Year column to the existing Dates Table.

Fiscal Year = 
VAR FirstFiscalMonth = 3
RETURN
    IF (
        'Date Table'[Month] >= FirstFiscalMonth,
        'Date Table'[Year] + 1,
        'Date Table'[Year]
    )

To add a Fiscal Year column, use this DAX expression. The purpose of the Fiscal Year column is to determine the fiscal year corresponding to each date in the Date Table based on a specified fiscal month.

This column holds significance because a fiscal year’s commencement is not necessarily tied to January 1st, as observed in the conventional calendar.

With this syntax, you can tailor the date parameters to harmonize with the fiscal date, aligning them with the operational rhythm of a business’s activities.

The DAX expression used for creating the fiscal year column is explained below:

1. Fiscal Year – defines the name of the calculated column that will be created.

2. VAR FirstFiscalMonth = 3 – a DAX variable named FirstFiscalMonth that’s assigned a value of 3. This variable essentially indicates that the fiscal year starts in the third month.

3. RETURN – a keyword used when defining variables within a DAX expression. In this context, it signifies the commencement of the expression that will be yielded for the calculated column.

4. IF ('Date Table'[Month] >= FirstFiscalMonth, 'Date Table'[Year] + 1, 'Date Table'[Year])

  • The IF function assesses a condition based on the month value in the Month column and compares it to the specified fiscal starting month.
  • If the month is greater than or equal to this starting month (3), it adds 1 to the corresponding Year column value to represent the fiscal year for dates falling after the fiscal starting month.
  • Conversely, if the month is below the fiscal starting month, the Year column value remains unchanged, denoting the fiscal year for dates before the fiscal starting month.

From this image, you will see that months with the value 3 have their Fiscal Year column as 2023. And months with a value of 2 have their Fiscal Year as 2022.

To further enhance this date table, consider adding additional columns. This will broaden the dimensions available for analyzing a variety of metrics, ultimately leading to improved accuracy in your evaluations.

The subsequent sections will explain the other columns that you can add to the date table.

Fiscal Month Number Column

Given the distinction between fiscal dates and traditional calendar dates, establishing a fiscal month number column in the date table is essential.

This step ensures the alignment of standard calendar month numbers with an organization’s specific fiscal year framework. This will help to enhance the accuracy and relevance of your data analysis.

Fiscal Month No = 
VAR FirstFiscalMonth = 3
RETURN
    IF (
        'Date Table'[Month] >= FirstFiscalMonth,
        'Date Table'[Month] - 2,
        'Date Table'[Month] + 10
    )

The DAX expression above will assign a fiscal month number to each date in the table based on a specified fiscal starting month.

Here’s a breakdown of the formula:

1. Fiscal Month No – the name of the calculated column.

2. VAR FirstFiscalMonth = 3 – a variable that indicates the starting month of the fiscal year.

3. RETURN – indicates the start of the expression that will be returned for the calculated column.

4. IF ( 'Date Table'[Month] >= FirstFiscalMonth, 'Date Table'[Month] - 2, 'Date Table'[Month] + 10 ) – The IF function evaluates the ‘Date Table'[Month] >= FirstFiscalMonth condition and returns different values based on whether the condition is true or false.

  • 'Date Table'[Month] >= FirstFiscalMonth – this condition checks if the month number in the Month column is greater than or equal to the specified FirstFiscalMonth.
  • 'Date Table'[Month] - 2 – If the condition is true (meaning the month number is at or beyond the starting fiscal month number), the formula subtracts 2 from the month value.
  • 'Date Table'[Month] + 10 – If the condition is false (meaning the month is before the starting fiscal month number), the formula adds 10 to the month value.

With the IF function statement, the month numbering is shifted to match the fiscal year structure.

When you enter the DAX code, the Fiscal Month No column will be populated with the fiscal month numbering considering the specified fiscal starting month and adjusts the month numbers accordingly.

Fiscal Quarter Column

An analysis of metrics based on quarters is very useful and a commonplace way of keeping up with trends. As such, having a fiscal quarter column in your date table can be very useful.

Fiscal Quarter = 
SWITCH (
    TRUE,
    AND ( 'Date Table'[Fiscal Month No] >= 1, 'Date Table'[Fiscal Month No] <= 3 ), "Q1",
    AND ( 'Date Table'[Fiscal Month No] >= 4, 'Date Table'[Fiscal Month No] <= 6 ), "Q2",
    AND ( 'Date Table'[Fiscal Month No] >= 7, 'Date Table'[Fiscal Month No] <= 9 ), "Q3",
    AND ( 'Date Table'[Fiscal Month No] >= 10, 'Date Table'[Fiscal Month No] <= 12 ), "Q4"
)

To calculate the values for the Fiscal Quarter column, the DAX expression uses a SWITCH statement. This formula categorizes each date into the appropriate fiscal quarter. Here’s a breakdown of the formula:

1. Fiscal Quarter – This defines the name of the calculated column that will be created.

2. SWITCH ( TRUE, AND ( 'Date Table'[Fiscal Month No] >= 1, 'Date Table'[Fiscal Month No] <= 3 ), "Q1", AND ( 'Date Table'[Fiscal Month No] >= 4, 'Date Table'[Fiscal Month No] <= 6 ), "Q2", AND ( 'Date Table'[Fiscal Month No] >= 7, 'Date Table'[Fiscal Month No] <= 9 ), "Q3", AND ( 'Date Table'[Fiscal Month No] >= 10, 'Date Table'[Fiscal Month No] <= 12 ), "Q4") – The SWITCH function evaluates multiple conditions and returns different values based on the conditions that evaluate TRUE.

The AND function combines two or more conditions to check whether the Fiscal Month No falls within specific ranges for each fiscal quarter. If a condition evaluates to TRUE, it returns the corresponding quarter (Q1, Q2, Q3, or Q4).

  • For the first quarter (Q1), the condition checks if the Fiscal Month No is between 1 and 3.
  • For the second quarter (Q2), the condition checks if the Fiscal Month No is between 4 and 6.
  • For the third quarter (Q3), the condition checks if the Fiscal Month No is between 7 and 9.
  • For the fourth quarter (Q4), the condition checks if the Fiscal Month No is between 10 and 12.

With this DAX expression entered, you generate a Fiscal Quarter column that looks like what is in the image above.

Fiscal Week Number Column

To determine the fiscal week number for each date, you need to identify the week number of the initial fiscal date. Subsequently, you can employ the IF function to establish a logic that computes the corresponding fiscal week numbers.

Including a fiscal week number column brings numerous benefits. It facilitates tracking sales and revenue, budgeting and forecasting, operational analysis, as well as creating custom analysis and insights. In addition, it enhances the comprehension of data at a more granular level.

Fiscal Week Number = 
VAR FirstFiscalWeek = 11
RETURN
    IF (
        'Date Table'[WeekNum] >= FirstFiscalWeek,
        ( 'Date Table'[WeekNum] ) - ( FirstFiscalWeek - 1 ),
        52 + ( 'Date Table'[WeekNum] ) - ( FirstFiscalWeek - 1 )
    )

This DAX expression will create the fiscal week number for every date. Here’s a breakdown of the expression.

1. Fiscal Week Number – defines the name of the calculated column that will be created.

2. VAR FirstFiscalWeek = 11 – a variable that indicates the starting fiscal week.

3. RETURN IF ( 'Date Table'[WeekNum] >= FirstFiscalWeek, ( 'Date Table'[WeekNum] ) - ( FirstFiscalWeek - 1 ), 52 + ( 'Date Table'[WeekNum] ) - ( FirstFiscalWeek - 1 ) ) – This marks the start of the expression that will be returned for the calculated column. The IF function is used to evaluate a condition and return different values based on whether the condition is true or false.

  • Date Table'[WeekNum] >= FirstFiscalWeek – this checks if the week number in the WeekNum column is greater than or equal to the specified FirstFiscalWeek value.
  • ('Date Table'[WeekNum] ) - ( FirstFiscalWeek - 1 ) – If the condition is true (meaning the week number is at or beyond the starting fiscal week), the week number is adjusted by subtracting `FirstFiscalWeek – 1.
  • 52 + ( 'Date Table'[WeekNum] ) - ( FirstFiscalWeek - 1 ) – If the condition is false (meaning the week number is before the starting fiscal week), the week number is adjusted by subtracting `FirstFiscalWeek – 1` and then adding 52. This adjustment ensures that week numbers before the starting fiscal week are represented correctly.

Once you input the DAX expression, the Fiscal Week Number column will be populated with the accurate fiscal week number corresponding to each date within the table.

Fiscal Week End Column

This additional logic column is established to ascertain the week-ending date for each fiscal week’s date. This information empowers the calculation of the equivalent week period in the previous year accurately.

It facilitates the optimal deduction of metrics for that specific period, allowing for meaningful comparisons between the current and previous periods based on the chosen fiscal week number.

Fiscal Week End = 
    FORMAT (
        'Date Table'[Date] - MOD ( 'Date Table'[Date] - 1, 7) + 6,
        "dd-mmm-yyyy"
    )

Use this DAX expression to create the Fiscal Week End values. This expression calculates the date of the last day (Saturday) of the fiscal week that corresponds to a given date.

Here’s a breakdown of the formula:

1. Fiscal Week End – defines the name of the calculated column.

2. FORMAT (..., "dd-mmm-yyyy") – This part of the formula applies a specific date format to the calculated fiscal week-end date. It ensures that the date is displayed in the format “dd-mmm-yyyy” (day-month-year).

3. 'Date Table'[Date] - MOD ('Date Table'[Date] – 1, 7)  + 6 – This calculates the date of the last day (Saturday) of the fiscal week. The MOD function calculates the number of days remaining until the end of the week.

The MOD function achieves this by adjusting the ‘Date Table'[Date] column’s reference date backwards by 1 (‘Date Table'[Date] – 1). The result is then divided by 7, yielding a remainder that signifies the days elapsed after a full week.

Subsequently, this remainder is subtracted from the ‘Date Table'[Date] column’s reference date, effectively resetting the date to the week’s initial day (Sunday). To pinpoint the date of the week’s last day (Saturday), 6 is added to this value.

With this calculation, the date of the last day of the week for every fiscal date can be ascertained.

By creating this column, you can understand the time frame of fiscal weeks and present the fiscal week-end dates consistently.

Conclusions

The fiscal date table serves as a powerful instrument to drive strategic initiatives and optimize operational efficiencies, making it an indispensable asset in the realm of business analytics.

The creation of this table within Power BI emerges as a crucial stride towards facilitating precise and contextually pertinent time-based analyses. As seen in the article, the utilization of diverse DAX functions enables the generation of requisite columns for the fiscal date table.

By customizing the calendar structure to harmonize with your distinct fiscal cycles, this methodology amplifies the accuracy of financial reporting, projection, and informed decision-making.

About the Author

Oluwaseun Olatoye

Oluwaseun Olatoye

Oluwaseun is a business intelligence analyst with expertise in Google Sheets, Excel, Power BI, SQL. He has worked with various businesses to make data-driven decisions. He enjoys helping others learn and grow.

Related Articles

Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Get the Latest Tech Tips

Write For Us

Are you a tech enthusiast with a talent for writing great content? Come write for us!

Follow Us

Follow us on social media to stay up to date with the latest in tech!