Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
New Contributor

Dynamically display value based on year

Hi, 

I have a textbox that shows the value accordingly based on the year i hardcoded in.

=count({1<[DTO Year]={"2019"},[YTD DTO]= {">=45"}>}DISTINCT [Customer])

Currently, i'm trying to display it when user select the year but can't get it right. 

When no selection, display the max year, else display the value accordingly. if(GetFieldSelections ([DTO Year]) = '2016',
count({<[YTD DTO]= {">=45"}>}DISTINCT [Customer]),
if(GetFieldSelections ([DTO Year]) = '2017',
count({<[YTD DTO]= {">=45"}>}DISTINCT [Customer])))

1 Solution

Accepted Solutions
Highlighted
Honored Contributor II

Re: Dynamically display value based on year

Hi ,

This seems to be working:

=count({1<[DTO Year]={$(vMonth)},[YTD DTO]= {">=30 <45"}>}DISTINCT [Customer])

Pfa sample: check the text box, it shows the expected number on selecting years

Br,

KC

Best Regards,
KC

View solution in original post

8 Replies
Highlighted
New Contributor

Re: Dynamically display value based on year

Also tried =count({$<[DTO Year]=,[YTD DTO]= {">=45"}>}DISTINCT [Customer])

Means if DTO year is ? (2016, 2017, 2018 or 2018) and YTD DTO is more than or equal to 45 then show the respective result. 

Highlighted
Honored Contributor II

Re: Dynamically display value based on year

Hi DestinedTale,

May be try like this:

Create a variable:

vMonth = if(GetSelectedCount([DTO Year])=0,max([DTO Year]),Concat(distinct chr(39)& [DTO Year] & chr(39),','))

No use this expression:

=count({1<[DTO Year]={$(vMonth)},[YTD DTO]= {">=45"}>}DISTINCT [Customer])

 

Br,

KC

Best Regards,
KC
Highlighted
New Contributor

Re: Dynamically display value based on year

encounter this error while texting in textbox 

Error: Error in set modifier ad hoc element list : ',' or ')' expected

Highlighted
Honored Contributor II

Re: Dynamically display value based on year

Can you please share a sample qvw ?

Best Regards,
KC
Highlighted
Honored Contributor II

Re: Dynamically display value based on year

You have to add and "=" before the expression while declaring the variable.

 

Br,

KC

Best Regards,
KC
Highlighted
New Contributor

Re: Dynamically display value based on year

attached a sample. 

Textbook with 13 is the expression where i used to hardcode the year to 2019. 

When select the year, your expression does not show the correct values. 

Highlighted
New Contributor

Re: Dynamically display value based on year

Hi, added the = but still doesn't work. 

Highlighted
Honored Contributor II

Re: Dynamically display value based on year

Hi ,

This seems to be working:

=count({1<[DTO Year]={$(vMonth)},[YTD DTO]= {">=30 <45"}>}DISTINCT [Customer])

Pfa sample: check the text box, it shows the expected number on selecting years

Br,

KC

Best Regards,
KC

View solution in original post