DAX · UDF
Date.FiscalQuarter
Trimestre fiscal da data.
Categoria: Ano fiscalTipo: UDFVersão: v1.1.0Fonte: Paulo André Jesus — OfficeTuningAtualizado em: 25/09/2026
Documentação completa na Function Library →Sintaxe
Date.FiscalQuarter ( pDate, pStartMonth )Argumentos
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
| pDate | DATETIME VAL | Sim | Data. |
| pStartMonth | INT64 VAL | Sim | Mês de início do ano fiscal (1 a 12). |
Retorno
Número inteiro
Código completo
DEFINE
/// Trimestre fiscal da data.
/// @param {DATETIME} pDate - Data.
/// @param {INT64} pStartMonth - Mês de início do ano fiscal (1 a 12).
/// @returns Trimestre fiscal, de 1 a 4.
FUNCTION Date.FiscalQuarter =
( pDate : DATETIME VAL, pStartMonth : INT64 VAL ) =>
VAR vShiftedMonth = MOD ( MONTH ( pDate ) - pStartMonth + 12, 12 ) + 1
RETURN
ROUNDUP ( vShiftedMonth / 3, 0 )
EVALUATE
{ Date.FiscalQuarter ( DATE ( 2025, 5, 15 ), 7 ) } // 4Exemplos
EVALUATE { Date.FiscalQuarter ( DATE ( 2025, 5, 15 ), 7 ) }
// 4Dicas e observações
💡 Com início em julho, maio é o 11º mês fiscal: 4º trimestre.