Forum Discussion

i820017's avatar
i820017
Resolver II
4 years ago
Solved

Date to YearMonth Column

I am trying to create a column that takes a date in mm/dd/yyyy and turns it into YearMonth. (The name of the column that I am working with is 'Procedure Request Form'[Date Request Submitted])

 

For example:

09/14/2001

10/15/2002

11/16/2003

 

will become

200109

200210

200311

 

 

I have tried using LEFT and RIGHT, but it doesn't work

 

 

  • oh....!!! This should work now. 🙂

    Column = IF(ISBLANK('Table'[Column1]),BLANK(),FORMAT(DATEVALUE('Table'[Column1]),"YYYYMM"))

     

9 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi i820017 

    You can create a column this way, Column = FORMAT ([Date Request Submitted], "YYYYMM" )

    And you will get the desired result.

     
  • I am still getting an error.

     

     

     

    This is weird because Date Request Submitted is a Date as seen below.

     

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi i820017 ,

     

    Please try below:-

    Column = FORMAT(DATEVALUE('Table'[Column1]),"YYYYMM")

     

    Thanks,

    Samarth

    • i820017's avatar
      i820017
      Resolver II

      I used DATEVALUE, and I still get an error.

       

       

      • Samarth_18's avatar
        Samarth_18
        Community Champion

        i820017 Please try this:-

        Column = 
        var result = FORMAT(DATEVALUE('Table'[Column1]),"YYYYMM")
        return IF(ISBLANK(result),BLANK(),result)