MONTHPERIOD

Filters data for a specific month or a range of months in the specified year.

The MONTHPERIOD function can be used to select data from a given measure for a particular month or a range of months. It should be used in conjunction with the SELECT clause and with an aggregate function like SUM or AVERAGE.

Syntax

MONTHPERIOD(year, from_month, to_month)

Arguments

year – The year for which data has to be fetched. Required.

from_month – The month for which data has to be fetched or the start month if a range is specified. Values can be between 1 and 12. Required.

to_month - The end month when a range of data has to be fetched. Values can be between 1 and 12. Optional.

Return value

Period Range.

Example

MONTHPERIOD(2024,1,4) 
//Returns data from January to April of 2024
MONTHPERIOD(2025,5)
//Returns data from May, 2025
MONTHPERIOD without offset
MONTHPERIOD with offset

Last updated

Was this helpful?