Forum Discussion
More_BI
9 years agoFrequent Visitor
Pull in only latest data from data source
Hey guys, I currently scan through various folders and pull in a series of spreadsheets that are generated each month with the latest KPI data. The problem arises during the reporting period when...
ImkeF
Community Champion
9 years agoYou can easily select only those rows of a table who have the latest value in the [Period] like this:
Table.SelectRows(Table, each [Period]=List.Max(Table[Period]))
This assumes that the natural sort order of the values in Column "Period".
If that's not the case, you can check if rows are returned once you select the latest period (and take those then) and if it is empty, filter the previous period like this:
if Table.RowCount(Table.SelectRows(Table, each [Period]=LastPeriod)) >0 then Table.SelectRows(Table, each [Period]=LastPeriod)
else Table.SelectRows(Table, each [Period]=PreviousPeriod)