Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Using only the most recent data for a querie

Hello -

I have a querie that is derived from a primary querie that essentially just pivots some data.  My primary querie pulls in 53 weeks of data, but for this axulary querie, I only need the most recent data set.  

I haven't set this up correctly, so I've had to go back in each week and manually update the work week for the axulary querie to pull from.  How can I set this up better?

See below:

WW08 is the week I originally set it up, WW35 is the last manual change I made (this week).

let

    Source = SharePoint.Files("https://Company.sharepoint.com/sites/CompanyRASIT/", [ApiVersion = 15]),

    #"Sorted Rows" = Table.Sort(Source,{{"Date created", Order.Descending}}),

    #"Kept First Rows" = Table.FirstN(#"Sorted Rows",1),

    #"P6DataWW08'23 xlsx_https://Company sharepoint com/sites/CompanyRASIT/Shared Documents/SITExport/" = #"Kept First Rows"{[Name="P6DataWW35'23.xlsx",#"Folder Path"="https://Company.sharepoint.com/sites/CompanyRASIT/Shared Documents/SITExport/"]}[Content],

    #"Imported Excel Workbook" = Excel.Workbook(#"P6DataWW08'23 xlsx_https://Company sharepoint com/sites/CompanyRASIT/Shared Documents/SITExport/"),

    Sheet1_Sheet = #"Imported Excel Workbook"{[Item="Sheet1",Kind="Sheet"]}[Data],

    #"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),

(Continues)

1 Reply

  • Needs more details.  Do you want this to wrap around when a new year starts?