Navee1990
Navee1990

Reputation: 21

Power BI How to extract month and year from a date

I have a column containing dates in the following format: "28-SEP-2018 12.40.00", does anyone know how to extract the month and year from the date in a new column (i.e. Sep- 2018), via producing a measure.

Upvotes: 1

Views: 20783

Answers (3)

Priyanka2304
Priyanka2304

Reputation: 210

New Date =FORMAT([date], "MMM") & "-" & YEAR([date])

This would give you a column with text data type. You can further create a column to sort the New Date column as per calendar chronology.

Upvotes: 0

Nandan
Nandan

Reputation: 4925

Assuming the type of the column is Text and you want the new values to be displayed as SEP-2018 rather than 09-2018:

enter image description here

You would need to create a new column with DAX as c1 = MID(Table2[Column1],4,8)

In case if the column is of type: DateTime ; then use the below DAX for new column :FORMAT(Table2[Column1],"MMM-YYYY")

Upvotes: 1

user14865552
user14865552

Reputation:

@navee1990 the measure to extract the date and year is as follows

= MONTH([date] & YEAR([date])

Or the long way

CONCATENATE(MONTH([date]),YEAR([date]))

Upvotes: 1

Related Questions