Forum Discussion
Power Query Editor Combine Multiple Columns to Create Single Date Column from bls.gov APIv2
- 6 years ago
MFelix,
I chose to perform the conversion in Query Editor to keep things clean. Your example worked perfectly once I changed the [Year] and [Month] to Whole Numbers.
Thanks for your help. I totally missed the ability to do the conversion this way.
Hi knotpc ,
You can do this in two different ways on the query editor or on DAX, in both manners no need to add the day column to your data since one of the date parameters is the day so you can place 1 on that part of the formula.
Query Editor
Add the following column:
Column with the Day column
#date([Year] , Number.FromText([Month]) , [Day])
Column wihtout the need for the day column
#date([Year] , Number.FromText([Month]) , 1)
The month part is convert to number since on your example you have it as text if all columns are number then just do the following
#date([Year] , [Month], [Day])
DAX
Add the following column:
Date = DATE('Table'[Year];'Table'[Mont];1)
Both should work as expected then just need to format as date.
Regards.
MFelix
- knotpc6 years agoAdvocate I
MFelix,
I chose to perform the conversion in Query Editor to keep things clean. Your example worked perfectly once I changed the [Year] and [Month] to Whole Numbers.
Thanks for your help. I totally missed the ability to do the conversion this way.