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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
crjackson
Helper I
Helper I

Folder Query

Hello!

I am trying to set up a folder query so that the users can save the report each month and update the dataset. My issue is that each month's report also includes the previous month's numbers. Is there a way to set this up where the previous months don't duplicate without manual manipulation each time they save? See the example below. For October's report, I don't want them to have to manually delete September's data to avoid doubling the totals.

 

crjackson_0-1674246795928.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

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

AlexisOlson
Super User
Super User

You could load from folder but only take the latest file which contains the data from all the previous months.

Would that work if you have multiple years? 

I don't know how you've got things set up for multiple years. Does each report only contain data from that year? If yes, then filter for December or the latest. If each report is cumulative over all years, just take the latest.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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