Forum Discussion

gco's avatar
gco
Resolver II
6 years ago
Solved

Calendar question

Hi there,

 

I have a date column that shows dates for current year (01/01/2019-12/31/2019).  And i would like to create a calculated column called "IsCurrentorPastMonth?" and will have a value of Y or N.  Would anyone know what the calculated column would look like?

 

Sample:

 

Dates                 IsCurrentorPastMonth?

01/02/2019         Y

07/02/2019         Y

10/01/2019         Y

11/03/2019        N

12/02/2019        N

 

Your help is greatly appreciated!

Thank you

Glen

  • Nathaniel_C's avatar
    Nathaniel_C
    6 years ago

    Hi gco ,

    Here is the input form for the conditional column.


    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
    Nathaniel

     

11 Replies

    • gco's avatar
      gco
      Resolver II

      Hi Nathaniel,

       

      yes, it will be for current month.  So like 10/31 would be Y

      Thank you

      Glen

    • Nathaniel_C's avatar
      Nathaniel_C
      Community Champion

      Hi gco 

      Doing this in Power Query is more efficient. Matches your post.
      Let me know if you have any questions.

      If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
      Nathaniel

       

       

      = Table.AddColumn(#"Changed Type1", "CurrentDate", each if Date.Month([#"Dates                 IsCurrentorPastMonth?.1"]) <= Date.Month(DateTime.LocalNow()) then "Y" else "N")

       

      • Nathaniel_C's avatar
        Nathaniel_C
        Community Champion

        Just tried it with 10/31 and it works.  Good point.