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: 
Not applicable

Re : variable Creation

Hi...

I need to create a varible based on the following conditions

I have a W_date and G_Date. G_Date is the one with Calendar is made.

conditions:

1. If no selection the variable should give Max(W_Date)

2. if any period is selected ie. (Year,Month,Week,Quarter etc..) it should give max of Monthend of tht slected period.

3. and if W_Date is nt available for tht Max selected period it should show Max(w_date)

i have created a variable as below

=if(getselectedcount(FY)=0 and getselectedcount(MonthYear)=0 and getselectedcount(Month)=0 and getselectedcount(Quarter)=0 and getselectedcount(Week)=0,
date(max(WDATE)),
if(date(monthend(max(date([GDate]))))>date(max(WDATE)),date(max(WDATE)),date(monthend(max(date([GDate]))))))


Here it will satisfy the first 2 conditions bt the third condition is incomplete.

if(date(monthend(max(date([GDate]))))>date(max(WDATE)),date(max(WDATE))

this is not the one which i wanted.

if i select apr, with is what i was gettin will be the data of 30/04/2014. now i need to check in WDATE filed if ths date is available or not .if the date exists then it should show that date else max(WDATE).

how can i check the existance of this value in a field?

please suggest me a solution...

Thanks

1 Reply
pokassov
Specialist
Specialist

Hi!

You can separate your variable in 2:

1. var1: calculate Max(W_Date) or Monthend(GDate), like you wrote in your message.

2. var2:

     if(count({$<W_Date={'$(=date(var1))'}>}=0,

          Max(G_Date), Max(W_Date))