Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

join 2 columns

I got a table with one column the year YYYY and one column the month MM, how I can create a date column where there will bee MM/YYYY ( column created must be formatted as a date in order to use them

SAMEPERIODLASTYEAR function
  • Hi Anonymous ,

    Based on my test, you could refer to below steps:

    Sample data:

    Create below formula:

    Column = CONCATENATE('Table2'[Month],CONCATENATE("/",'Table2'[Year]))

    And change the format:

     

    Regards,

    Daniel He

3 Replies

  • v-danhe-msft's avatar
    v-danhe-msft
    Microsoft Employee

    Hi Anonymous ,

    Based on my test, you could refer to below steps:

    Sample data:

    Create below formula:

    Column = CONCATENATE('Table2'[Month],CONCATENATE("/",'Table2'[Year]))

    And change the format:

     

    Regards,

    Daniel He

  • Anonymous's avatar
    Anonymous
    Not applicable

    I always prefer to do transformations like this in the Query editor for multiple reasons. You could approach this in multiple ways, here I will assume you dont have a day column and therefor map all to the first day in the month.

     

    Go to the query editor:

    - Create a custom column "Day" with this formula: "1" (you now have a column with value 1 in all rows)

    - Highlight your Year, Month and Day columns in that order and under "Add Column" choose "Merge Columns", pick a custom separator "-" and apply. Name the new Column "Date".

    - Format the new column as Date.

     

    Hope that helps :)

     

  • v-danhe-msft's avatar
    v-danhe-msft
    Microsoft Employee

    Hi Anonymous ,


    Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered to close this topic?

     

    Regards,

    Daniel He