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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors