Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Show date

Hi all,

To answer a certain question I need to find a date within a month, based on a calendar.

What I would like to have is this:

MonthFirst saturdaySecond saturdayThird saturdayFourth saturdayFifth saturday
0105-01-201312-01-201319-01-201326-01-2013-
02




03




04




05




Could anyone explain to me how I can find these dates with an expression?

I will need this date to use it in a variable.

Thanks.

Henco van Ee

7 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     If you only want Saturday then you can do this in script like shown below.

     Load Date, if(inweek(Date,Monthstart(Date)),if(WeekDay(Date)='Sat',1)) as First_Sat_Flag

     From xyz;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Anonymous
Not applicable
Author

Hi Kaushik,

Thanks for your reply. I tried your suggestion, but unfortunately I can´t get it done.

I attached an example document, I hope you would like to take a look at it?

Thanks in advance.

Kind regards,

Henco

er_mohit
Master II
Master II

Try this

Load Date, if(inweek(Date,Monthstart(Date)),if(Date(Date,'WWW')='Sat',1)) as First_Sat_Flag

     From xyz;

hope it helps

Not applicable
Author

Hey Mate,

Kaushiks did not work for you because your system settings for daynames has set 'sat' to 'za'. I've attached a complete solution that gives you the saturday appearance for each calendar month.

If anyone knows a simpler approach, would love for you to show us

Otherwise, hope this is what you were looking for

Cheers,

Byron

Message was edited by: Byron_van_wy Edit Done - For completeness I added a pivot table with the set analysis 🙂

Not applicable
Author

try this see attached.

anandathome
Creator
Creator

Hi Hanco,

     Try thr below application

-Anand

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try one of the fields created with this:

Calendar:

Load

            Date

            ,WeekDay(Date) as WeekDay

            ,ceil(Day(Date)/7) as Week

            ,if(WeekDay(Date)='za', ceil(Day(Date)/7)) as SatNum

Resident Calendar_tmp;

See attached example.


talk is cheap, supply exceeds demand