Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello,
I am a PBI user in training. Here's my problem. I have three columns of which one is Day, one is Month and one is Year. All three of these columns are whole numbers. I want to use these three columns to create a the date (day, month, & year) in one column. I would like this to be done on the database side in Power Query.
I have read in some other threads as to how this is done, but I cannot get it to work. So, I am either missing something, or I am attempting something which is not possible (I doubt its this) or the approach requires other steps I am missing.
Any help / support would be greatly appreciated.
Here are the three columns:
Solved! Go to Solution.
NewStep=Table.AddColumn(PreviousStepName,"Date",each #date([YEAR],[MONTH],[DAY]))
The M language uses this notation for certain literals like #time, #date, #duration, #binary, #table.
See here for the syntax of all of the value kinds:
https://docs.microsoft.com/en-us/powerquery-m/m-spec-values
Note that #date is not a function at all. It's a value.
NewStep=Table.AddColumn(PreviousStepName,"Date",each #date([YEAR],[MONTH],[DAY]))
@wdx223_Daniel Thank you. This worked. I believe I tried this before which did not work, but with one missing character you used. I did not use "#" before date. Why is "#" being used before date? If you don't mind providing a simple explanation it would be greatly appreciated. Just for my education and background - and for others who may benefit.
The M language uses this notation for certain literals like #time, #date, #duration, #binary, #table.
See here for the syntax of all of the value kinds:
https://docs.microsoft.com/en-us/powerquery-m/m-spec-values
Note that #date is not a function at all. It's a value.
I understand the solution provided but I have a day of year instead of just day. In DAX, there is a calculated column which uses Day() to convert this to a day to use in a DAX formula to create a date but I want to do this in Power Query. How do I amend the Power query formula for this?