Forum Discussion

JEJP's avatar
JEJP
New Member
3 years ago
Solved

Formula Date doesn't work

Hello,

I have made my Dax formula, but it still gives an error. It says that the An argument of function 'DATEhas the wrong data type or the result is too large or too small. What is wrong with my formula? Field GeboorteDatum (Birthdate) is a Date type.

 

  • JEJP 

    Please try

    Birthdaynext =
    VAR Items =
    SUBSTITUTE ( Medewerker[GebrooteDatum], "-", "|" )
    VAR TheYear =
    YEAR ( TODAY () )
    VAR TheMonth =
    PATHITEM ( Items, 2 )
    VAR TheDay =
    PATHITEM ( Items, 1 )
    VAR ThisYearX =
    IFERROR ( DATE ( TheYear, TheMonth, TheDay ), BLANK () )
    VAR NextYearX =
    IFERROR ( DATE ( TheYear + 1, TheMonth, TheDay ), BLANK () )
    RETURN
    IF ( TODAY () > ThisYearX, NextYearX, ThisYearX )

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi JEJP ,

    I create a table to test, it works well, could you provide the desensitized example data for me to test.

    Column =
    VAR _a =
        DATE ( YEAR ( TODAY () ), MONTH ( 'Table'[Column1] ), DAY ( 'Table'[Column1] ) )
    VAR _b =
        DATE ( YEAR ( TODAY () ) + 1, MONTH ( 'Table'[Column1] ), DAY ( 'Table'[Column1] ) )
    RETURN
        IF ( TODAY () > _a, _b, _a )
    

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • JEJP's avatar
      JEJP
      New Member

      Thank you very much. I already found the solution, but this formula also works!

      • tamerj1's avatar
        tamerj1
        Icon for Community Champion rankCommunity Champion

        JEJP 

        Please try

        Birthdaynext =
        VAR Items =
        SUBSTITUTE ( Medewerker[GebrooteDatum], "-", "|" )
        VAR TheYear =
        YEAR ( TODAY () )
        VAR TheMonth =
        PATHITEM ( Items, 2 )
        VAR TheDay =
        PATHITEM ( Items, 1 )
        VAR ThisYearX =
        IFERROR ( DATE ( TheYear, TheMonth, TheDay ), BLANK () )
        VAR NextYearX =
        IFERROR ( DATE ( TheYear + 1, TheMonth, TheDay ), BLANK () )
        RETURN
        IF ( TODAY () > ThisYearX, NextYearX, ThisYearX )