Forum Discussion
IF
5 years agoPost Prodigy
dynamic week table
Hi, I want to develop a dynamic week table, which should list the weeks for last 119 weeks (or last three years). The table will always keep the last 119 weeks. I plan to use the following, but the ...
- 5 years ago
See if the following is what you're trying to achieve?
//output let Source = List.Generate( ()=> {Date.StartOfWeek(Date.AddWeeks(DateTime.LocalNow(), -119)), 1}, each _{0} < Date.StartOfWeek(Date.AddWeeks(DateTime.LocalNow(), -1)), each {Date.AddDays(_{0}, 7), _{1}+1}, each {Text.Format("#{1}.#{0}", {Date.Year(_{0}), Date.WeekOfYear(_{0})}), _{1}} ), Tbl = Table.FromRows(Source, type table[#"Week No.Year" = text, Index = number]) in Tbl
IF
5 years agoPost Prodigy
Hi,
Is it possible to show the number of the weeks directly instead of showing each day?
Best
edhans
5 years agoCommunity Champion
IF on the weeks, you have to start with the date. Date tables must be all dates between the first and last date. I have a fully dynamic date table linked below with the weeks in it as a new column.