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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
rhaberkorn4
New Member

Filer Day.IsInCurrentWeek to start on Monday

Hello,

 

I am trying to crete a simple spread sheet using and ODBC connection and Power querry. I data dump the ODBC connection into excel and then use that table in Power querry. 

 

There is a Day of Week going back at least (2) years. I really only care about 'This Current' Week. I filter on 'Day.IsInCurrentWeek' and it starts on a Sunday. I would like it to start Monday to Sunday. 

 

I have read multiple forms and watched YouTube but my M Coding is not where it needs to be.  Any help would be apprecietated. Thank you

1 ACCEPTED SOLUTION

Use this for your last step

= Table.SelectRows(#"Reordered Columns3", each Date.IsInCurrentWeek(Date.AddDays([Day of Week],-1)))

View solution in original post

9 REPLIES 9
threw001
Helper I
Helper I

Hi guys

 

I am trying to do something similar - I am based in Australia/Melbourne, I am using PowerBI Service to refresh my reports. 

I am getting false return for function date.isincurrentweek when the report refreshes on Monday at around 4am Australia/Melbourne time as it is taking the UTC time (which is still in the prior week).

Is there anyway around this? Please see below my query

 

Thanks

let
    Source = Query1(#date(2016, 1, 1), 5000, #duration(1, 0, 0, 0)),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Date"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "yearWeek", each Date.Year([Date])*100+Date.WeekOfYear([Date])),
    #"Removed Duplicates" = Table.Distinct(#"Added Custom", {"yearWeek"}),
    #"Added Index" = Table.AddIndexColumn(#"Removed Duplicates", "Index", 0, 1, Int64.Type),
    #"Renamed Columns1" = Table.RenameColumns(#"Added Index",{{"Index", "WeekCounter"}}),
    #"Added Custom1" = Table.AddColumn(#"Renamed Columns1", "IsCurrentWeek", each Date.IsInCurrentWeek([Date]))
in
    #"Added Custom1"

 

Vijay_A_Verma
Super User
Super User

If you want to use Monday as the start day for Date.IsInCurrentWeek, use 

Date.IsInCurrentWeek(Date.AddDays([Date],-1))

Hence, you will have to insert following step where #"Changed Type" is previous step

 

= Table.SelectRows(#"Changed Type", each Date.IsInCurrentWeek(Date.AddDays([Date],-1)))

 

Thank you,

 

I tried to enter the code you porovided into the advanced editor and it is giving me error.  I have attached the current advianced editor code.

 

rhaberkorn4_0-1708011799172.png

 

I can't see Date.IsInCurrentWeek anywhere in your code? If you could highlight, that would be great.

Thank you. At the very bottom. Let me know if this is not what you are looking for

rhaberkorn4_0-1708025671653.png

 

Go to UI - Click on Filtered Rows1 in right pane - In Formula bar, delete everything and copy my code..

THANK YOU! I am sorry if this was very frustrating. I really apprecieate your help. This worked. 

 

Thank you thank you thank you!

Use this for your last step

= Table.SelectRows(#"Reordered Columns3", each Date.IsInCurrentWeek(Date.AddDays([Day of Week],-1)))

I am so sorry. I am not getting this. Does that code go in place of the #"Filtered Rows1" or after? Does the very last line "in #Filtered Rows1" need to be changed after that. I put the code in and I just get this response.

 

rhaberkorn4_0-1708088144945.png

 

rhaberkorn4_1-1708088159839.png

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors