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.
Hi,
I have loaded my data to PQ and I have a date (DD/MM/YYYY) column. To be able to sort the date from the oldest to the newest, I have added a custom column
Date.Year([Date])*100 + Date.Month([Date])
this gives me a new column with the following format date YYYYMM
So far so good.
The issue is that when I load my data back to Excel I do not want this format, rather I would like this format MMM YY so that it is clearer. I have attached a pic to illustrate.
Any help will be appreciated
Solved! Go to Solution.
I found a way to do it, here is the code
YYYYMM = Table.AddColumn(#"Colonnes permutées", "YYYY_MM", each Date.Year([Date])*100 + Date.Month([Date])),
YY = Table.AddColumn(YYYYMM, "Year", each Text.Middle(Text.From([YYYY_MM], "en-GB"), 2, 2), type text),
mmm_YY = Table.AddColumn(YY, "MMM", each Date.MonthName( Number.FromText( (Text.End(Text.From([YYYY_MM], "en-GB"), 2)))*29)),
Deleted = Table.RemoveColumns(mmm_YY,{"Posted", "Name", "No.", "Amount"}),
Format_MMM = Table.TransformColumns(Deleted, {{"MMM", each Text.Start(_, 3), type text}}),
Final = Table.CombineColumns(Format_MMM,{"MMM", "Year"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Month")
in
Final
but maybe someone has a better code to do it in less steps 🙂
Thanks for your time
Anyone has an idea ?
I found a way to do it, here is the code
YYYYMM = Table.AddColumn(#"Colonnes permutées", "YYYY_MM", each Date.Year([Date])*100 + Date.Month([Date])),
YY = Table.AddColumn(YYYYMM, "Year", each Text.Middle(Text.From([YYYY_MM], "en-GB"), 2, 2), type text),
mmm_YY = Table.AddColumn(YY, "MMM", each Date.MonthName( Number.FromText( (Text.End(Text.From([YYYY_MM], "en-GB"), 2)))*29)),
Deleted = Table.RemoveColumns(mmm_YY,{"Posted", "Name", "No.", "Amount"}),
Format_MMM = Table.TransformColumns(Deleted, {{"MMM", each Text.Start(_, 3), type text}}),
Final = Table.CombineColumns(Format_MMM,{"MMM", "Year"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Month")
in
Final
but maybe someone has a better code to do it in less steps 🙂
Thanks for your time
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 |
---|---|
14 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
13 | |
11 | |
9 | |
6 | |
6 |