March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi Everyone,
I am trying to get the second latest Friday date; I tried applying TOP N filter too but it didn't work. Please help me with this. I have a column with a list of Friday Dates.
Regards,
Rabi
Solved! Go to Solution.
Hi @Rabi
If you already have Date / Calendar table, adjust accordingly TOPN and FILTER part.
I created calculated column to check if 'Date'[Date] is expected value as you have.
My timezone is Europe (GMT+) - this is important as today is Friday and your time zone could be different so output could be different.
Did I answer correctly? Kudos appreciate / accept solution.
Proud to be a Super User!
@Rabi I just saw this post, although you already have a solution but for last year friday, it need tweaking because the logic will fail on leap year.
SameDayLastYear_Friday =
VAR __LastYear =
DATE(YEAR('Date'[SecondLastFriday])-1,MONTH('Date'[SecondLastFriday]),DAY('Date'[SecondLastFriday]))
VAR __WeekDayOffset = 6 - WEEKDAY ( __LastYear, 1 )
RETURN
__LastYear + __WeekDayOffset
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Rabi you can
2nd Last Friday From Today =
VAR __Today = TODAY ()
VAR __TodayWeekDay = WEEKDAY ( __Today, 1 )
VAR __OffSet = IF ( __TodayWeekDay >= 6, __TodayWeekDay - 6, __TodayWeekDay + 1 ) + 7
RETURN __Today - __OffSet
also use this expression to get the 2nd last Friday without iterating over date table:
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Rabi if you want most recent Friday from today then use this:
2nd Last Friday From Today =
VAR __Today = TODAY ()
VAR __TodayWeekDay = WEEKDAY ( __Today, 1 )
VAR __OffSet = IF ( __TodayWeekDay >= 6, __TodayWeekDay - 6, __TodayWeekDay + 1 )
RETURN __Today - __OffSet
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Rabi if you want most recent Friday from today then use this:
2nd Last Friday From Today =
VAR __Today = TODAY ()
VAR __TodayWeekDay = WEEKDAY ( __Today, 1 )
VAR __OffSet = IF ( __TodayWeekDay >= 6, __TodayWeekDay - 6, __TodayWeekDay + 1 )
RETURN __Today - __OffSet
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Rabi you can
2nd Last Friday From Today =
VAR __Today = TODAY ()
VAR __TodayWeekDay = WEEKDAY ( __Today, 1 )
VAR __OffSet = IF ( __TodayWeekDay >= 6, __TodayWeekDay - 6, __TodayWeekDay + 1 ) + 7
RETURN __Today - __OffSet
also use this expression to get the 2nd last Friday without iterating over date table:
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Rabi I just saw this post, although you already have a solution but for last year friday, it need tweaking because the logic will fail on leap year.
SameDayLastYear_Friday =
VAR __LastYear =
DATE(YEAR('Date'[SecondLastFriday])-1,MONTH('Date'[SecondLastFriday]),DAY('Date'[SecondLastFriday]))
VAR __WeekDayOffset = 6 - WEEKDAY ( __LastYear, 1 )
RETURN
__LastYear + __WeekDayOffset
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @Rabi "second latest Friday date" on 15.09.2023 is what date? I am aksing as today is 15.09.2023 and depending when you answer "second latest Friday date" will be another date.
Proud to be a Super User!
Hi @some_bih
Current friday is 15/09/2023 but I want to filter my data with last week's friday date which is 08/09/2023
Thanks !!
Hi @Rabi
If you already have Date / Calendar table, adjust accordingly TOPN and FILTER part.
I created calculated column to check if 'Date'[Date] is expected value as you have.
My timezone is Europe (GMT+) - this is important as today is Friday and your time zone could be different so output could be different.
Did I answer correctly? Kudos appreciate / accept solution.
Proud to be a Super User!
Hi @some_bih
can you also help me with getting a year date from last week's Friday date for instance, last week Friday date was 08/09/2023 its a year equivalent would be 08/09/2022
thanks for help !!
Hi @Rabi
For Friday / Monday option, just adjust part
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
15 | |
12 | |
9 | |
8 |
User | Count |
---|---|
41 | |
32 | |
29 | |
12 | |
12 |