Date.IsLeapYear

DAXData e hora

Indica se o ano é bissexto no calendário gregoriano.

Sintaxe

DAX
Date.IsLeapYear ( pYearNumber )

Parâmetros

pYearNumberINT64 VALObrigatório

Ano.

DAX
2028

Tipo de retorno

Verdadeiro/falso

Exemplos

DAX
EVALUATE { Date.IsLeapYear ( 2028 ), Date.IsLeapYear ( 1900 ), Date.IsLeapYear ( 2000 ) }
// TRUE · FALSE · TRUE

Código completo

DAX
DEFINE
    /// Indica se o ano é bissexto no calendário gregoriano.
    /// @param {INT64} pYearNumber - Ano.
    /// @returns TRUE se o ano for bissexto.
    FUNCTION Date.IsLeapYear =
        ( pYearNumber : INT64 VAL ) =>
        MOD ( pYearNumber, 400 ) = 0
            || ( MOD ( pYearNumber, 4 ) = 0 && MOD ( pYearNumber, 100 ) <> 0 )

EVALUATE
{ Date.IsLeapYear ( 2028 ), Date.IsLeapYear ( 1900 ), Date.IsLeapYear ( 2000 ) }  // TRUE · FALSE · TRUE

Mais informações

Fonte
Paulo André Jesus — OfficeTuning
Versão
1.1.0

Conhecer a trilha Power BI ao vivo