Forum Discussion

efilipe's avatar
efilipe
Helper IV
9 years ago
Solved

Identify leap day

Hi guys,

 

I have a lot of erros of my CSV file because they have added unexisting dates (leap day). I have to fix it using PowerBI, since I cant touch the CSV file. Any ideas?

 

Thank you!

 

if ([ANO_NASCIMENTO] > 2000) then "" else if Date.FromText([DAYDATE] & "/" & [MONTHDATE] & "/" & [YEARDATE]) else ""

 

Thank you!

Edgard

  • efilipe

    I'm not sure exactly what they've added to the data - February 29th for all years?

     

    But you can create a Column in your Calendar to help you identify Leap versus Not Leap Year with this formula

    Leap/Not Leap Year =
    IF (
        OR (
            MOD ( 'Table'[Year], 400 ) = 0,
            AND ( MOD ( 'Table'[Year], 4 ) = 0, MOD ( 'Table'[Year], 100 ) <> 0 )
        ),
        "Leap Year",
        "Not a Leap Year"
    )

    Hope this helps! :smileyhappy:

1 Reply

  • Sean's avatar
    Sean
    Community Champion

    efilipe

    I'm not sure exactly what they've added to the data - February 29th for all years?

     

    But you can create a Column in your Calendar to help you identify Leap versus Not Leap Year with this formula

    Leap/Not Leap Year =
    IF (
        OR (
            MOD ( 'Table'[Year], 400 ) = 0,
            AND ( MOD ( 'Table'[Year], 4 ) = 0, MOD ( 'Table'[Year], 100 ) <> 0 )
        ),
        "Leap Year",
        "Not a Leap Year"
    )

    Hope this helps! :smileyhappy: