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.
I want to turn this column into a date type in power query but keep the month-year format. How can I achieve this on power query?
You cannot. If you want the date displayed like that in the Power Query UI, you will have to set the data type to text and use a formula like:
Table.TransformColumns(#"Previous Step",{"Column Name", each Date.ToText(_,"MM-yyyy"), type text})
Unlike Excel (or Power BI), Power Query does not have a separate formatting option for data.
I tried implementing your idea. In the step prior I made PGP Match a text type and then in the following step I implemented your step but got the result seen in the picture below. What did I do wrong?
Maybe I am misunderstanding you.
If you already have the column PGP Match as text, there's no need to change it into anything. As I wrote, you cannot change it into a date and have it display as `MM-yyyy` in the Power Query editor.
My solution is a method of generating PGP Match from a column that already has a Date.
Okay that makes sense. I misunderstood you the first time. Thank you.
In Power Query, when you turn text string "11-2022" into a date, it will add a day which is the first date of the month. Without a day being specified, it is not a date. Hence, here is no real date which is called "11-2022".
It seems that you are looking for a display solution.
In Power Query, you could keep date 2022-11-01 (or 01/11/2022 or 11/01/2022 or whatever your local date format is). In Power BI or Excel, you can change the display format for that particular column to "MM-YYYY"
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.