Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3585

Re: Calculating the Last Friday Date of Each Month

$
0
0

Hi Jamie,

 

Create the below 3 variables

  • Last Date of Month  =LastDayOfMonth([Date])

This gives the last Date of the month

 

  • Dayname of Last Date of Month =DayName([Last Date of Month])

This gives the Dayname of last date of Month.

 

  • Date for Last Friday of Month

=If([Dayname of Last Date of Month]="Saturday") Then RelativeDate([Last Date of Month];-1)

ElseIf([Dayname of Last Date of Month]="Sunday") Then RelativeDate([Last Date of Month];-2)

ElseIf([Dayname of Last Date of Month]="Monday") Then RelativeDate([Last Date of Month];-3)

ElseIf([Dayname of Last Date of Month]="Tuesday") Then RelativeDate([Last Date of Month];-4)

ElseIf([Dayname of Last Date of Month]="Wednesday") Then RelativeDate([Last Date of Month];-5)

ElseIf([Dayname of Last Date of Month]="Thursday") Then RelativeDate([Last Date of Month];-6)

Else [Last Date of Month]

This gives the Date of Last Friday of Month.


I tried it and it works perfect, let me know if this helps.


Thanks,
Mahboob Mohammed


Viewing all articles
Browse latest Browse all 3585

Trending Articles