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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
jfernand
Frequent Visitor

Efficient way to filter until last specific weekday

hi team,

 

I'm building a filter for a calculation so that it computes data between 01-01-2016 until last Friday.

How can I filter the calculation until "last Friday"? 

I thought about doing the below, assuming today is Tuesday, and replicate the process all other days of the week but it seems very long and unnefficient

*for tuesdays*
IF (WEEKDAY ( TODAY() , 1) = 3 ;             *if today is tuesday*
     TODAY() - 4) ;
      IF(weekday ( TODAY() , 1) = 4;            *if today is wednesday*
      TODAY() - 5) ;
         IF ....           

1 ACCEPTED SOLUTION
v-caliao-msft
Employee
Employee

@jfernand,

 

Please try the expression below.

weekday = WEEKDAY('Table'[Date],1)
lastFriday = IF('Table'[weekday]=7,'Table'[Date]-1,'Table'[Date]-'Table'[weekday]-1)

Capture.PNG

 

Regards,

Charlie Liao

 

View solution in original post

1 REPLY 1
v-caliao-msft
Employee
Employee

@jfernand,

 

Please try the expression below.

weekday = WEEKDAY('Table'[Date],1)
lastFriday = IF('Table'[weekday]=7,'Table'[Date]-1,'Table'[Date]-'Table'[weekday]-1)

Capture.PNG

 

Regards,

Charlie Liao

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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