Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
106 | |
87 | |
77 | |
69 |
User | Count |
---|---|
123 | |
112 | |
95 | |
83 | |
73 |