Forum Discussion

gbarr12345's avatar
gbarr12345
Post Prodigy
2 years ago
Solved

Calculated columns with date seperated

Hi everyone,

 

I'm looking to create new calculated columns to seperate the already existing Date column I have. 

 

I want to have one column with just the day, another column with just the month and another column with just the year.

 

Any idea on how to do this?

 

Any help would be greatly appreciated.

 

 

  • Hi gbarr12345 

     

    You asked for Calculated Columns so in DAX you would use 

     

     

    Day = DAY('DataTable'[Promotion_Week_Ending])
    Month = MONTH('DataTable'[Promotion_Week_Ending])
    Year = YEAR('DataTable'[Promotion_Week_Ending])

     

     

    But if you want Custom Columns in Power Query use these

     

    = Date.Day([Promotion_Week_Ending])
    = Date.Month([Promotion_Week_Ending])
    = Date.Year([Promotion_Week_Ending])

     

    Regards

     

    Phil

     

2 Replies

  • Hi gbarr12345 

     

    You asked for Calculated Columns so in DAX you would use 

     

     

    Day = DAY('DataTable'[Promotion_Week_Ending])
    Month = MONTH('DataTable'[Promotion_Week_Ending])
    Year = YEAR('DataTable'[Promotion_Week_Ending])

     

     

    But if you want Custom Columns in Power Query use these

     

    = Date.Day([Promotion_Week_Ending])
    = Date.Month([Promotion_Week_Ending])
    = Date.Year([Promotion_Week_Ending])

     

    Regards

     

    Phil

     

    • gbarr12345's avatar
      gbarr12345
      Post Prodigy

      Thank you very much for that. Much appreciated!