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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
AllanBerces
Post Prodigy
Post Prodigy

PQ Column change to Date and filter previous week and current Week

Hi good day can anyone help me on my PQ, i want to change below to date column and filter previous week and current week dynamically.

AllanBerces_0-1758264202050.png

Thank you

1 ACCEPTED SOLUTION
ZhangKun
Super User
Super User

let
    源 = Excel.CurrentWorkbook(){[Name="表1"]}[Content],
    更改的类型 = Table.TransformColumnTypes(源,{{"dt", type text}}),
    已添加自定义 = Table.AddColumn(更改的类型, "自定义", each Date.FromText([dt], [Format="dd'th' MMMM yyyy", Culture=""])),
    筛选的行 = Table.SelectRows(已添加自定义, each Date.IsInPreviousWeek([自定义]) or Date.IsInCurrentWeek([自定义]))
in
    筛选的行

View solution in original post

3 REPLIES 3
ZhangKun
Super User
Super User

let
    源 = Excel.CurrentWorkbook(){[Name="表1"]}[Content],
    更改的类型 = Table.TransformColumnTypes(源,{{"dt", type text}}),
    已添加自定义 = Table.AddColumn(更改的类型, "自定义", each Date.FromText([dt], [Format="dd'th' MMMM yyyy", Culture=""])),
    筛选的行 = Table.SelectRows(已添加自定义, each Date.IsInPreviousWeek([自定义]) or Date.IsInCurrentWeek([自定义]))
in
    筛选的行

Hi @ZhangKun thank you very much for the reply work as i need

 

AndreasKiller
Frequent Visitor

Replace "st", "nd" and "rd" with "", then change the data type of the column to Date.

 

If that doesn't work change the locale in the Power Query options to English(USA) or English(UK).

 

Now you're able to filter the column as you like.

 

Andreas.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors