Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi guys
I'm trying to add a column with a date. I have two columns, two fields, year and month, both numeric values.
The idea is something like this... =DATE((YEAR)Anod, (Month)Mesd) and of course it's not working.
I have two questions:
1. How can i learn the formulas wich are available and how to aply them (youtube videos for example)
2. How do i make this function to work
Many thanks for your reply
Best regards
Pedro
Solved! Go to Solution.
@pedroccamara Are you attempting to do this in the query editor? If so, don't. The above solution is DAX, and you can implement by just right clicking on the table you want to apply the new column to and click on "New colomn" - this is where you would input the DAX syntax.
Using the query editor allows you to use "M" code to create columns etc. 2 different languages.
If you want to add the date column in Query Editor, you can add a custom column with following formula.
Number.ToText ( [Month] ) & "/" & "1" & "/" & Number.ToText ( [Year] )
Then change the type of this column to “Date”.
If you want to use DAX, please following the solution provided by Eno1978.
Best Regards,
Herbert
If you want to add the date column in Query Editor, you can add a custom column with following formula.
Number.ToText ( [Month] ) & "/" & "1" & "/" & Number.ToText ( [Year] )
Then change the type of this column to “Date”.
If you want to use DAX, please following the solution provided by Eno1978.
Best Regards,
Herbert
@pedroccamara Looks like something like this would work.
Date = FORMAT(([Month] & "/01/" & [Year]), "mm-dd'yyyy")
Then just change the Data Type to Date, and set to whatever format you want. My assumption is that since you don't have a "Day" that you would just default to the first day of the month.
Hello Eno
I've just change the field names like this ... FORMAT(([Mês] & "/01/" & [Ano]), "mm-dd'yyyy") and it gives me an expression error "The name FORMAT wasn't recognized"...
Any ideas?
@pedroccamara Are you attempting to do this in the query editor? If so, don't. The above solution is DAX, and you can implement by just right clicking on the table you want to apply the new column to and click on "New colomn" - this is where you would input the DAX syntax.
Using the query editor allows you to use "M" code to create columns etc. 2 different languages.
You're the MAN!!
Thank you very much
Best regards
Pedro
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 54 | |
| 47 | |
| 39 | |
| 16 | |
| 15 |
| User | Count |
|---|---|
| 83 | |
| 71 | |
| 39 | |
| 29 | |
| 27 |