cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DSwezey
Helper II
Helper II

Create Date column from Year and Month columns

I have a table with a column of Month NUmber and a column for Year. I want to make a date column for the 1st of the month. The new column I want to be formatted [Month Number]/1/[Year] 

Example: the second row is February 2021. I want the new date column to look like 2/1/2021.

 

DSwezey_0-1637781833540.png

 

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@DSwezey  this was to be done in PQ.

For DAX use this 

Column = DATE('Table'[Year],'Table'[Month Number],1)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






New Animated Dashboard: Sales Calendar


View solution in original post

4 REPLIES 4
smpa01
Super User
Super User

@DSwezey  this was to be done in PQ.

For DAX use this 

Column = DATE('Table'[Year],'Table'[Month Number],1)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






New Animated Dashboard: Sales Calendar


smpa01
Super User
Super User

@DSwezey  create a new column as 

#date([Year],[Month Number],1)

and then format as you wish through DAX





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






New Animated Dashboard: Sales Calendar


I get this error when adding the custom column. 

DSwezey_0-1637783203939.png

 

date <> #date

 

change 

 

date([Year],[Month Number],1)

 

to (as written by @smpa01 )

     

 

#date([Year],[Month Number],1)

 

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May 23 2022 episode 5 with aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt will talk about the importance of Data Modeling.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!