Create a Year-Month Text Column in Excel Power Query
Question details
Create a Power Query text column containing a fixed prefix, a year, and a two-digit month, even when the source has no date column.

- Product
- Microsoft Excel Power Query
- Device & OS
- not provided
- Scenario
- The user wants values such as TEST 202208 in a custom column.
- Observed behavior
- The desired column combines a fixed label with a four-digit year and a zero-padded month.
Open the query in Power Query Editor and check whether the source has separate Year and Month columns. If it does not, decide whether to use a fixed period or the current date at refresh.
Combine Year and Month Columns in Power Query
Use this method when the query already has separate Year and Month columns, whether they contain numbers or text.
In Excel, select Data > Queries & Connections, then double-click the query to open Power Query Editor.
Select Add Column > Custom Column and enter a name such as YearMonthText.
In the custom column formula box, enter "TEST " & Text.From([Year]) & Text.PadStart(Text.From([Month]), 2, "0"). Replace Year and Month with your exact column names if they differ.
Select OK, check that a year of 2022 and month of 8 produce TEST 202208, then select Home > Close & Load.

Create a Fixed Year-Month Value Without Date Columns
Use a fixed year and month when every row should receive the same period.
Use the Current Year and Month at Refresh
Use this method when the period should come from the current date rather than a source column.
Work With Year-Month Data in WPS Spreadsheet
WPS Office is a free, lightweight alternative with a familiar interface for working with spreadsheets and moving existing files. WPS Spreadsheet can format year-month values with worksheet formulas, but it does not fix Excel Power Query or replace its query refresh workflow.

Frequently Asked Questions
How do I add a leading zero to the month?
In Add Column > Custom Column, use Text.PadStart(Text.From([Month]), 2, "0"). For example, a month value of 8 becomes 08.
Do I need a date column to create TEST 202208?
No. You can combine separate Year and Month columns, enter a fixed year and month in a custom column, or derive the current period with DateTime.LocalNow().
Can I use the formula if Year and Month are already text?
Yes. Text.From works with text values as well as numbers. If the month text already has two digits, you can also use "TEST " & [Year] & [Month].
Why did the current year-month value change?
A formula using DateTime.LocalNow() is recalculated when the query refreshes. Use fixed values in Add Column > Custom Column if the period should remain unchanged.




