Forum Discussion
Folder Query
- Anonymous3 years ago
Hi crjackson ,
If you want to keep only the latest month's data. Please try this:= Table.FromColumns({List.First(Table.ToColumns(PreviousStepName))} & {List.Last(Table.ToColumns(PreviousStepName))})all steps:
let Source = Excel.Workbook(File.Contents("C:\Users\v-cgao\Desktop\New Microsoft Excel Worksheet.xlsx"), null, true), Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data], #"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"Column1", type text}, {"Sep'22", Int64.Type}, {"Oct'22", Int64.Type}}), #"Demoted Headers" = Table.DemoteHeaders(#"Changed Type"), Custom1 = Table.FromColumns({List.First(Table.ToColumns(#"Demoted Headers"))} & {List.Last(Table.ToColumns(#"Demoted Headers"))}), #"Promoted Headers" = Table.PromoteHeaders(Custom1, [PromoteAllScalars=true]), #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Column1", type text}, {"Nov'22", Int64.Type}}) in #"Changed Type1"Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi crjackson ,
If you want to keep only the latest month's data. Please try this:
= Table.FromColumns({List.First(Table.ToColumns(PreviousStepName))} & {List.Last(Table.ToColumns(PreviousStepName))})
all steps:
let
Source = Excel.Workbook(File.Contents("C:\Users\v-cgao\Desktop\New Microsoft Excel Worksheet.xlsx"), null, true),
Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"Column1", type text}, {"Sep'22", Int64.Type}, {"Oct'22", Int64.Type}}),
#"Demoted Headers" = Table.DemoteHeaders(#"Changed Type"),
Custom1 = Table.FromColumns({List.First(Table.ToColumns(#"Demoted Headers"))} & {List.Last(Table.ToColumns(#"Demoted Headers"))}),
#"Promoted Headers" = Table.PromoteHeaders(Custom1, [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Column1", type text}, {"Nov'22", Int64.Type}})
in
#"Changed Type1"
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum