Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Talk to Experts, a LIVE Q&A Webinar. Bring your Qlik Sense Business questions on Aug. 4th. Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Variable Concerns

Dear all,

Let me explain my case as below,

Now we want to set the latest date based on different country, so we set in the script like this:

LOAD 

    Max(TIME_KEY) as Asofdates,

  DATE(MonthStart(DATE(Date#(max(TIME_KEY),'YYYYMMDD'),'MM/DD/YYYY')),'YYYYMMDD') as MonthBegin,

    DATE(MonthStart(DATE(Date#(max(TIME_KEY),'YYYYMMDD'),'MM/DD/YYYY'),-12),'YYYYMMDD') as MonthBegin_lastyear,

    Upper(AFFILIATE_CODE) as COUNTRY

    FROM [lib://SM1/01_QS_Documents\Sales.QVD](qvd)

   group By AFFILIATE_CODE;

So we set variable

v_Daily_MonthBegin=(MonthBegin)

v_Daily_MonthBegin_lastyear=(MonthBegin_lastyear)


Then we want to select the latest 12 month, so use script below in the table and filter

=if(I_Time_Key>v_Daily_MonthBegin_lastyear and I_Time_Key<= v_Daily_MonthBegin,I_Time_Key),


but the scope not changed, always based on one country no matter what country we select,  also the variable will update when we select country. Please give me your suggestion how to achive the function? Thanks.


Best Regards,

Haifeng

Tags (1)