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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set modifiers in to a variable

Hi

I am Creating a Dashboard for Profit & Loss. I have used the following code to access Period to date figure depend on the user selection.

It is working perfectly.

if (ValueList('Direct Income','Direct Expense','Gross Profit','Other Expense','Profit Before Other Income','Other Income','Net Profit')='Direct Income',

   sum({$<PeriodID={"<=$(=Max(PeriodID)-12)"},[Financial Year]={$(=Max([Financial Year])-101)},Period=,[Account Type]={'D'}>}$(eAccountBalance)),

I have tried to set up a variable for the PeriodID and Financial Year(User Selection) and cried to used it in the main expression as below but the variable vSetPTD initialization is giving me an error.

vSetPTD


PeriodID={"<=$(=Max(PeriodID)-12)"},[Financial Year]={$(=Max([Financial Year])-101)},Period=

**Main Expression

sum({$<$(vSetPTD),[Account Type]={'D'}>}$(eAccountBalance)),

Is their a way to overcome this issue.

Thank you.

Harsh

2 Replies
tresesco
MVP
MVP

While defining variable put the string within single quotes like:

vSetPTD

= 'PeriodID={"<=$(=Max(PeriodID)-12)"},[Financial Year]={$(=Max([Financial Year])-101)},Period='

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

Variable :

vSetPTD (No = in the variable declaration)


PeriodID={"<=$(=Max(PeriodID)-12)"},[Financial Year]={$(=Max([Financial Year])-101)},Period=

Expression : = sum({$<$(vSetPTD),[Account Type]={'D'}>}$(eAccountBalance)),

Regards,

jagan.