MicroStrategy ONE

FiscalWeek

Returns the numeric position of a week within a fiscal year, for a given input date. This function is useful in financial reporting when the start of the fiscal year is different than the start of the calendar year.

Syntax

FiscalWeek<firstWeekDay, firstMonth>(Date/Time)

Where:

  • Date/Time is the input date or timestamp.
  • firstWeekDay (default value is 1) is a parameter that determines which day of the week is considered as the first day of the week. You can type an integer value from 1 to 7, with 1 representing Sunday, 2 representing Monday, and so on until 7 representing Saturday.
  • firstMonth (default value is 1) is a parameter that determines which month is considered as the start of the fiscal year. You can type an integer value from 1 to 12, with 1 representing January, 2 representing February, and so on until 12 representing December.

For information on whether your database supports various date and time functions, see MicroStrategy and Database Support for Functions.

Example

Consider a report or dashboard that includes a Day attribute with a single ID form. You can create a metric with the following definition:

FiscalWeek<firstWeekDay=1, firstMonth=7>(Day)

For each element of the Day attribute, the metric displays the numeric position of the week within the fiscal year for that date. For this example, since the fiscal year starts in July, a date of July 8, 2014 would return 2. This is because the first fiscal week runs from July 1st through July 5th. Then on July 6th, the first Sunday of the fiscal year, the second fiscal week starts. This week includes July 8th, and so 2 is returned.