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
Anonymous
Not applicable

Filter dates as from previous ISO week (also valid when year change)

Hello,

I have the following data in a table visualization in Power BI. I am trying to filter the rows based on the Date column.

I am trying to filter all dates which are in the previous week and later.

The week is ISO, so it always starts on Monday and ends on Sunday.

The solution should also work for year change. For example, in ISO week number 1 for 2023, the filtered results should include the dates as from week number 52 in the previous year.

Is this possible? Any help is much appreciated!

 

DateStockReturnsDefective
08/08/2022348
01/01/20226917
27/05/20222510
20/10/20229316
07/08/20225615
12/08/20222210
17/08/20227822
20/08/20223313
22/08/20226318
29/08/20223314
07/09/20222717
16/09/20223722
23/11/20227520
11/12/20229818
04/01/20236716
17/02/202371434
1 ACCEPTED SOLUTION

2 Comments

1 - Your date dimension only goes up to the current date so showing future records would be tough.  Try extending it to the end of the current year or some other future date.

2 - Since you already have [CurWeekOffset], the following column should work for you.

Display = 'Calendar'[CurWeekOffset] >= -1
 
I hope I understood you correctly.
 

View solution in original post

5 REPLIES 5
ryan_mayu
Super User
Super User

@Anonymous 

is this what you want?

Column =
VAR yearweek=year('Date'[Date])*100+WEEKNUM('Date'[Date],2)
return yearweek<year(today())*100+WEEKNUM(today(),2)
 
1.PNG
when you select true , you will get all the date before this week.




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

Proud to be a Super User!




Anonymous
Not applicable

Hi @ryan_mayu Thank you for your reply!

Here are the results from your formula but it is not quite right:

MakeItReal_1-1661131966959.png

We are currently in ISO week number 34, which started on Monday 22 August 2022.

I would like to filter all the dates as from the previous week, that is, ISO week number 33 which started on Monday 15 August 2022.

Here are the expected results (dates are sorted from oldest to newest):

DateStockReturnsDefectiveFilter
01/01/20226917FALSE
27/05/20222510FALSE
07/08/20225615FALSE
08/08/2022348FALSE
12/08/20222210FALSE
17/08/20227822TRUE
20/08/20223313TRUE
22/08/20226318TRUE
29/08/20223314TRUE
07/09/20222717TRUE
16/09/20223722TRUE
20/10/20229316TRUE
23/11/20227520TRUE
11/12/20229818TRUE
04/01/20236716TRUE
17/02/202371434TRUE

@Anonymous 

Updated the DAX.

pls see the attachment to see if this works for you

 





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

Proud to be a Super User!




Anonymous
Not applicable

@ryan_mayu The table is showing all values from beginning of 2022 to end of 2023. Instead, it should only show the expected results as in my previous post.

 

MakeItReal_0-1661161339030.png

I have uploaded a new PBIX file with a calendar and i added the ISOYearWeekNum column to it. I also imported the original table. Is it possible to filter the Date column and get the expected results (without any additional rows)?

 

Download link from my Google Drive: https://drive.google.com/file/d/1C9anYhragY_6Z8ArHU7c9mxwDkWBn_ku/view?usp=sharing

 

MakeItReal_1-1661161587404.png

Expected results:

MakeItReal_3-1661161891536.png

2 Comments

1 - Your date dimension only goes up to the current date so showing future records would be tough.  Try extending it to the end of the current year or some other future date.

2 - Since you already have [CurWeekOffset], the following column should work for you.

Display = 'Calendar'[CurWeekOffset] >= -1
 
I hope I understood you correctly.
 

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.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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