Date.FiscalYear

DAXAno fiscal

Ano fiscal da data, identificado pelo ano em que termina.

Sintaxe

DAX
Date.FiscalYear ( pDate, pStartMonth )

Parâmetros

pDateDATETIME VALObrigatório

Data.

DAX
DATE ( 2025, 8, 1 )
pStartMonthINT64 VALObrigatório

Mês de início do ano fiscal (1 a 12).

DAX
7

Tipo de retorno

Número inteiro

Exemplos

DAX
EVALUATE { Date.FiscalYear ( DATE ( 2025, 8, 1 ), 7 ), Date.FiscalYear ( DATE ( 2025, 8, 1 ), 1 ) }
// 2026 · 2025

Código completo

DAX
DEFINE
    /// Ano fiscal da data, identificado pelo ano em que termina.
    /// @param {DATETIME} pDate - Data.
    /// @param {INT64} pStartMonth - Mês de início do ano fiscal (1 a 12).
    /// @returns Ano fiscal. Com início em janeiro, é o próprio ano civil.
    FUNCTION Date.FiscalYear =
        ( pDate : DATETIME VAL, pStartMonth : INT64 VAL ) =>
        YEAR ( pDate ) + IF ( pStartMonth > 1 && MONTH ( pDate ) >= pStartMonth, 1, 0 )

EVALUATE
{ Date.FiscalYear ( DATE ( 2025, 8, 1 ), 7 ), Date.FiscalYear ( DATE ( 2025, 8, 1 ), 1 ) }  // 2026 · 2025

Mais informações

Fonte
Paulo André Jesus — OfficeTuning
Versão
1.1.0

Conhecer a trilha Power BI ao vivo