Power BI: Need to extract the Month and year from date as new column
- User
Power BI: Need to extract the Month and year from date as new column
- Assistant
To extract the month and year from a date column in Power BI and create a new column, you can follow these steps:
-
Open your Power BI Desktop application and go to the data view.
-
Select the table that contains the date column.
-
Go to the Modeling tab in the ribbon menu and click on "New Column" under the Calculations group.
-
In the formula bar, enter the following DAX formula to extract the month:
Month = FORMAT('YourTableName'[YourDateColumn], "MMM")Replace 'YourTableName' with the actual name of your table, and 'YourDateColumn' with the actual name of the date column you want to extract the month from.
-
Press Enter to create the new column.
-
Similarly, create another new column to extract the year. In the formula bar, enter the following DAX formula:
Year = YEAR('YourTableName'[YourDateColumn])Again, replace 'YourTableName' with the actual name of your table, and 'YourDateColumn' with the actual name of the date column you want to extract the year from.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.