Forum Discussion
lgo
2 years agoFrequent Visitor
How to filter by last value provided within a month
Hello! My data is provided weekly but i would like to get it monthly. The rule should be: latest value provided within a month = monthly value. Is that possible? My data looks like this, see...
- 2 years ago
Hi,
Maybe with Table.Group
= Table.FromRecords(
Table.Group(
Prev_Step,
{"Date"},
{{"Data", each Table.Max(_,"Date"), type record}},
GroupKind.Local,
(x,y) => Byte.From(Date.StartOfMonth(x[Date])<>Date.StartOfMonth(y[Date]))
)[Data]
)Stéphane
collinsg
Solution Sage
2 years agoGood day Igo,
Here is a suggestion. Each date is a Saturday so,
- Calculate the date of the last Saturday in the month.
- First find the end of the month.
- Find the start of the week the end of month falls in, where the start of the week is a Saturday.
- Select rows with date = date of the last Saturday.
= Table.SelectRows(PreviousStep, each [Date] = Date.StartOfWeek( Date.EndOfMonth([Date]), Day.Saturday ) )
Hope this helps.
- lgo2 years agoFrequent Visitor
Thank you so much for your answer collinsg! However... not sure I could use this option because when the operator is not available on sundays, it can fill in the number on fridays, or sundays, or even on mondays! Hence that solution cannot be used. Thanks anyway for your help! I am still trying to find out an answer 😕