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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
shyamcharan
Creator III
Creator III

Variable definition issue

Hi Experts,

I do have a basic table and variables created as below:

Table:

LOAD * INLINE [

    CalYrMnthNum, ThisYLM, LastYLM

    201607, 201606, 201506

    201606, 201605, 201505

];

SET vThisYLM = Max({<CalYrMthNum={"$(=Max(CalYrMthNum))"}>}ThisYLM);

SET vLastYLM = Max({<CalYrMthNum={"$(=Max(CalYrMthNum))"}>}LastYLM);

However, When I try to use the variable as =$(vThisYLM) i do not get any result.

Can anyone suggest what mistake i am doing here?

Please find the attached document.

Regards,

Shyam.

1 Solution

Accepted Solutions
sunny_talwar

Try this may be:

Table:

LOAD * INLINE [

    CalYrMnthNum, ThisYLM, LastYLM

    201607, 201606, 201506

    201606, 201605, 201505

];

LET vThisYLM = 'Max({<CalYrMnthNum={"$' & '(=Max(CalYrMnthNum))"}>}ThisYLM)';

LET vLastYLM = 'Max({<CalYrMnthNum={"$' & '(=Max(CalYrMnthNum))"}>}LastYLM)';

View solution in original post

6 Replies
Anil_Babu_Samineni

You have Date field like CalYrMnthNum

Buy, you using CalYrMthNum

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
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

It is because you do not have same field name in Table and in Variable.

Your variable uses "CalYrMthNum"

Where as your field name is CalYrMnthNum.

Correct it and then try.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
shyamcharan
Creator III
Creator III
Author

Hi Guys,

Thanks heaps for your responses.

Even after renaming the Field name still I have the same issue.

However, the issue seems to be around the $ sign in the load script.

I found a few tips in the link below.

Can I SET or LET a variable to include a $(=...)

Will try and find if any issues. Thanks again.

Regards,

Shyam.

Anil_Babu_Samineni

PFA

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
sunny_talwar

Try this may be:

Table:

LOAD * INLINE [

    CalYrMnthNum, ThisYLM, LastYLM

    201607, 201606, 201506

    201606, 201605, 201505

];

LET vThisYLM = 'Max({<CalYrMnthNum={"$' & '(=Max(CalYrMnthNum))"}>}ThisYLM)';

LET vLastYLM = 'Max({<CalYrMnthNum={"$' & '(=Max(CalYrMnthNum))"}>}LastYLM)';

shyamcharan
Creator III
Creator III
Author

Thanks Sunny.