Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello, I am trying to replace a text substring in a column, ideally directly in the Query Editor.
Let's call the column 'YearMonth', fields look like this: "202001", "201912", etc.
I'd like to replace the two last positions of the text strings where "01" should become "Jan", "02" become "Feb", "03" become "Mar" etc. I tried to do so with the "right"-function in combination with an if-statement. PowerBi prompts an error message for the if-statement not being allowed.
Any help would be appreciated. In the meantime I did a manual work-around in the source file, however would like to skip that step for the future.
Solved! Go to Solution.
Hi @1up
try this monster custom column
= Text.Combine({Text.Range([Date],0,4),Text.Range(Date.MonthName(#date(Number.FromText(Text.Range([Date],0,4)),Number.FromText(Text.Range([Date],4,2)),1)),0,3)})
but be sure that [Date] column has a Text format before add new column step
Hi @1up
try this monster custom column
= Text.Combine({Text.Range([Date],0,4),Text.Range(Date.MonthName(#date(Number.FromText(Text.Range([Date],0,4)),Number.FromText(Text.Range([Date],4,2)),1)),0,3)})
but be sure that [Date] column has a Text format before add new column step
Thanks a kudos for the help.
Hi @1up
Create custome column
=Text.Combine({Text.Middle(Text.From([YearMonth]),0,4),Text.Middle(Date.MonthName(#date(2020,Number.FromText(Text.Middle(Text.From([YearMonth]),4,2)),01)),0,3)})
YearMonth column is of Int.
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.
Thank you for the support and quick reply, Pravin.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
7 | |
6 |
User | Count |
---|---|
15 | |
13 | |
11 | |
9 | |
8 |