Forum Discussion
MERGE QUERIES
- 1 year ago
Hi himaan_she
Have a look at thisHere's the code:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Day", Int64.Type}, {"Month", Int64.Type}, {"Year", Int64.Type}}),
#"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Changed Type", {{"Day", type text}, {"Month", type text}, {"Year", type text}}, "en-IN"),{"Day", "Month", "Year"},Combiner.CombineTextByDelimiter("-", QuoteStyle.None),"Date"),
#"Changed Type1" = Table.TransformColumnTypes(#"Merged Columns",{{"Date", type date}})
in
#"Changed Type1"
Perhaps link to your file; check the data types of the Day/Month/Year columns in those rows you get errors, also check you're not trying to make impossible dates (eg. 31th April) and watch out for spaces and the like in those columns.
Separately, a one-liner to do this:
addMergedDate = Table.AddColumn(PreviousStep, "Date", each #date([Year],[Month],[Day]),type date)