Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
ADSL
Post Prodigy
Post Prodigy

Add Column Month & Year in Power Query

Hi BI Community Team,

 

I am getting error as the screenshot when trying to add/combine the column Month No. & Year to new column as the format: 1/1/2022 ---- 1/12/2022.

 

In Custom column formula = #date([Month No],[Year],1)

 

2023-04-14_08-34-32.png

 

2023-04-14_08-39-44.png

 

Any suggestion/advise of this case?

 

Thanks and Regards,

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @ADSL 

how about:

= #date([Year], [Month No],1)

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @ADSL

AFAIK, #date should be in this order - year, month, day.

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
FreemanZ
Super User
Super User

hi @ADSL 

how about:

= #date([Year], [Month No],1)

Ritaf1983
Super User
Super User

Hi @ADSL 
There are several ways to achieve your date format.
You can use the "column from example" functionality as follows:
1. Select the year and month columns

Ritaf1983_0-1681439238367.png

2. Add column from example

Ritaf1983_1-1681439295824.png

3 . In 2-3 lines, type the date in the desired format + press ok

(2 was enough for me, and he understood the logic)

Ritaf1983_3-1681439487143.png

4. Chnge data type to "date"

Ritaf1983_4-1681439625598.png

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements