Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Date table with no date column

Hi, 

 

I have a data where i have just Period column with short month (Jan, Feb, Mar, Apr.......,Dec). Rest all the column in numbers with yearly sales numbers. 

I want to convert the Period column into date column. If not possible then how do it make date able or any workaround for long term use. 

The period column is text column and sales are in Decimal numbers. 

@smpa01 @mahoneypat 

 

Period

Sales 21Sales 20Sales 19Region
Jan    
Feb    
Mar    
Apr    
May    
Jun    
Jul    
Aug    
Sep    

 

1 ACCEPTED SOLUTION

Can you clarify further?  I thought that is what was provided.  Can you show what the output table should look like?  Your data should be unpivoted for easiest analysis/visualization, and you will need a year component to convert the Period column to a date.

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
mahoneypat
Microsoft Employee
Microsoft Employee

Here is one way to do it with your example table structure.  It involves unpivoting your data, splitting the column with the year info and creating a new Date column.  To see how it works, just create a blank query, go to Advanced Editor, and replace the text there with the M code below.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkgtysxPUdJRCk7MSS1WMDJEMA3gTENLpVidaCWvxDygkCkQm4FpkJhbahKQbQIVNwGL+SYWQfmmcHWOBUVQdWZgDFFXiaHOqzQPScwEKpaDpBci5liajmQvRG9wagGSXqAdsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Period = _t, #"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Period", type text}, {"Sales 21", Int64.Type}, {"Sales 20", Int64.Type}, {"Sales 19", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Period"}, "Attribute", "Value"),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, false), {"Attribute.1", "Attribute.2"}),
    #"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter",{"Attribute.1"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Attribute.2", "Year"}, {"Value", "Sales"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Date", each Date.FromText("20"&[Year]&"-"&[Period]&"-1")),
    #"Removed Columns1" = Table.RemoveColumns(#"Added Custom",{"Year"})
in
    #"Removed Columns1"

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi @mahoneypat  

 

I tried this solution before posting the question but i have more than 20 columns with thousands of rows(didn't mentioned it earlier). 

Want to explore if the Month column could be covnverted into Date type and sales yearly column could be used with that column 


PA

Can you clarify further?  I thought that is what was provided.  Can you show what the output table should look like?  Your data should be unpivoted for easiest analysis/visualization, and you will need a year component to convert the Period column to a date.

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi @mahoneypat 

 

I was not able to access this thread to repsond to your suggestion. 

It's working now. I made date table and then  put a date column as suggested to get the issue resolved. 

 

Thanks for the help.

 

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors