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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
AllanBerces
Post Prodigy
Post Prodigy

Week in Power Query

Hi Good day,

Can anyone pls need help on my table below, How can i display on my table using power query the previuos week and previuos previuos week.

Let say now is Week 48, I want on my table to be display only is Week 47 and 46.

Week 49, diplay only Week 48 and 47.

 

AllanBerces_0-1732684837355.png

 

Thank you

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @AllanBerces - you can add a current week column in tables as below:

 

Date.WeekOfYear(DateTime.LocalNow())

 

rajendraongole1_0-1732686632476.png

 

This will give you the current week number.

 

Add a column to calculate the "Relative Week" by subtracting the WeekN column from the current week number:

WeekN=Date.WeekOfYear([Date])

 

Relative Week= [Current Week] - [WeekN]

rajendraongole1_1-1732687026786.png

 

rajendraongole1_2-1732687043722.png

 

 

This will create a column where:
0 represents the current week.
-1 represents the previous week.
-2 represents the week before that.
Filter Rows:

Apply a filter to the "Relative Week" column to include only rows where the value is -1 or -2.

After applying this query, your table will only display the relevant weeks (e.g., Week 47 and 46 if the current week is 48).

 

Hope it works .

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
ThxAlot
Super User
Super User

 

let
    Source = let today = DateTime.LocalNow(), offset = Date.DayOfWeek(today, Day.Monday) in List.Transform({1..14}, each Date.From(today-#duration(_+offset,0,0,0))),
    #"Last 2 Wks" = Table.FromList(Source, Splitter.SplitByNothing(), type table[Date=date])
in
    #"Last 2 Wks"

 

ThxAlot_1-1732696216815.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



rajendraongole1
Super User
Super User

Hi @AllanBerces - you can add a current week column in tables as below:

 

Date.WeekOfYear(DateTime.LocalNow())

 

rajendraongole1_0-1732686632476.png

 

This will give you the current week number.

 

Add a column to calculate the "Relative Week" by subtracting the WeekN column from the current week number:

WeekN=Date.WeekOfYear([Date])

 

Relative Week= [Current Week] - [WeekN]

rajendraongole1_1-1732687026786.png

 

rajendraongole1_2-1732687043722.png

 

 

This will create a column where:
0 represents the current week.
-1 represents the previous week.
-2 represents the week before that.
Filter Rows:

Apply a filter to the "Relative Week" column to include only rows where the value is -1 or -2.

After applying this query, your table will only display the relevant weeks (e.g., Week 47 and 46 if the current week is 48).

 

Hope it works .

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1 thank you very much for the reply its work great.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.