Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Changing all Monday dates to previous Friday dates

I have a column in my database (Post_Date)  and I need all the Monday dates in that column to point to the previous Friday date. In other words if the Post_Date day is a Monday, it should show the Post_Date to be that of the Friday before.

1 Solution

Accepted Solutions
sunny_talwar

May be like this:

Date(If(WeekDay(Post_Date) = 'Mon', Post_Date - 3, Post_Date)) as Post_Date

View solution in original post

4 Replies
sunny_talwar

May be like this:

Date(If(WeekDay(Post_Date) = 'Mon', Post_Date - 3, Post_Date)) as Post_Date

Anonymous
Not applicable
Author

It works, thanks a lot!

Anonymous
Not applicable
Author

It works only if the column name is changed:

Date(If(WeekDay(Post_Date) = 'Mon', Post_Date - 3, Post_Date)) as Rev_Post_Date

But when I try to use the revised column name for another IF condition in the script, it does not recognize it.

sunny_talwar

That is strange, can you share the complete script and where the issue is?