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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
obriaincian
Resolver I
Resolver I

Power Query Custom Step to filter table for second Monday of the month not working

Hi All,

 

I have created a custom step in Power Query to filter a table (table in Filtered Rows1) where the date created is teh second Monday of the month.

 

The issue is Power Query just colors the code red in the formula bar and outputs the code rather than a filtered table

let
    Source = #"Filtered Rows1",
    FirstDayOfMonth = Date.StartOfMonth(DateTime.LocalNow()), 
    FirstDayOfWeek = Date.StartOfWeek(FirstDayOfMonth, Day.Monday),
    SecondWeekStart = Date.AddDays(FirstDayOfWeek, 7),
    SecondWeekEnd = Date.AddDays(SecondWeekStart, 6),
    FilteredTable = Table.SelectRows(Source, each [Date created] >= SecondWeekStart and [Date created] <= SecondWeekEnd) 
in
    FilteredTable
1 REPLY 1
Ahmedx
Super User
Super User

pls try this

 

let
    Source = Date,
     FirstDayOfMonth = Date.StartOfMonth(DateTime.LocalNow()), 
    FirstDayOfWeek = Date.StartOfWeek(FirstDayOfMonth, Day.Monday),
    SecondWeekStart = Date.From( Date.AddDays(FirstDayOfWeek, 7)),
    SecondWeekEnd = Date.From( Date.AddDays(SecondWeekStart, 6)),
 FilteredTable = Table.SelectRows(Source, each [Date created] >= SecondWeekStart and [Date created] <= SecondWeekEnd) 
in
    FilteredTable

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors