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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

set analysis current week

Hi All,

Hope you could help me with the following:

var_max_date:                    =Max({1<Year={$(=Max({1}Year))},amount={">0"}>}date)

var_cur_week_start_date:  =DATE(WeekStart(var_max_date), 'YYYY-MM-DD')

var_cur_week_end_date:   =DATE(WeekEnd(var_max_date), 'YYYY-MM-DD')

I am calculating the amount for the current week:

in chart:

=sum({$<date={'>=$(var_cur_week_start_date)<=$(var_cur_week_end_date)'}>} amount)

It shows me the amount for the current week,but when I make selection in the date filter the amount for current selection is missing.

What can I do to preserve it?

7 Replies
Anil_Babu_Samineni

Try this?

=sum({1<var_max_date ={">=$(var_cur_week_start_date)<=$(var_cur_week_end_date)"}>} amount)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
its_anandrjs
Champion III
Champion III

Variables like this

LET var_max_date                  =Max({1<Year={$(=Max({1}Year))},amount={">0"}>}date);

LET var_cur_week_start_date  =DATE(WeekStart(var_max_date), 'YYYY-MM-DD');

LET var_cur_week_end_date  =DATE(WeekEnd(var_max_date), 'YYYY-MM-DD');

Expre:-

=sum({1<var_max_date ={'>=$(var_cur_week_start_date) <=$(var_cur_week_end_date)'}>} Val)

Anonymous
Not applicable
Author

Sorry I don't understand why I should use var_max_date in the expression. var_cur_week_start_date that is calculated based on var_max_date.

sum({1<date ={">=$(var_cur_week_start_date)<=$(var_cur_week_end_date)"}>} installs_omn)

Also if I will use 1, other filters like region or product won't inluence on the resul, but they should. What can I do?

Anil_Babu_Samineni

May be this?

sum({$<date ={"=Only({$<date = >} date) >= $(var_cur_week_start_date) and Only({$<date = >} date) <= $(var_cur_week_end_date)"}>} installs_omn)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

It doesn't work, shows 0.

Anonymous
Not applicable
Author

Sorry I don't understand why I should use var_max_date in the expression. var_cur_week_start_date that is calculated based on var_max_date.

sum({1<date ={">=$(var_cur_week_start_date)<=$(var_cur_week_end_date)"}>} installs_omn)

Also if I will use 1, other filters like region or product won't inluence on the resul, but they should. What can I do?

Anonymous
Not applicable
Author

Could you solve your issue? I had the same problem and fixed it in the following way:.

When loading the information try having the numeric value of the Date in another field, for example:

DATE(dateField, 'YYYY-MM-DD')    as date,

Num(dateField)                               as dateNum

And then use the numeric one in the set analysis:

=sum({$<dateNum={'>=$(var_cur_week_start_date)<=$(var_cur_week_end_date)'}>} amount)