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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Pbiuserr
Post Prodigy
Post Prodigy

YYYYMM integer code to DD/MM/YYYY date in PQ/DAX

Hello,

I have codes such as

202201

202207

which represents year 2022 and respective month where 01 is january, 07 is july etc.

I would like to change them to represent date for the first of that month so

 

202201 - 01/01/2022

202207 - 01/07/2022

 

Ideally in power query, may be in dax also

Thank you in advance for your help

2 ACCEPTED SOLUTIONS
evandrocunico
Resolver III
Resolver III

Hello, try this (dax)

 

NewDate = DATE(MID(202207,1,4),MID(202207,5,2),"01")

 

NEW DATE.png

View solution in original post

goncalogeraldes
Super User
Super User

Hello there @evandrocunico ! If you need it in PQ you can do the following:

 

= Table.AddColumn(Previous_Step, "Column_Name", each Text.Combine({"01/", Text.Middle([Date_Column], 4), "/", Text.Start([Date_Column], 4)}), type date)

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

View solution in original post

2 REPLIES 2
goncalogeraldes
Super User
Super User

Hello there @evandrocunico ! If you need it in PQ you can do the following:

 

= Table.AddColumn(Previous_Step, "Column_Name", each Text.Combine({"01/", Text.Middle([Date_Column], 4), "/", Text.Start([Date_Column], 4)}), type date)

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

evandrocunico
Resolver III
Resolver III

Hello, try this (dax)

 

NewDate = DATE(MID(202207,1,4),MID(202207,5,2),"01")

 

NEW DATE.png

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors