Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
DestinedTale
Contributor II
Contributor II

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])))

Labels (2)
1 Solution

Accepted Solutions
jyothish8807
Master II
Master II

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
DestinedTale
Contributor II
Contributor II
Author

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. 

jyothish8807
Master II
Master II

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
DestinedTale
Contributor II
Contributor II
Author

encounter this error while texting in textbox 

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

jyothish8807
Master II
Master II

Can you please share a sample qvw ?

Best Regards,
KC
jyothish8807
Master II
Master II

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

 

Br,

KC

Best Regards,
KC
DestinedTale
Contributor II
Contributor II
Author

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. 

DestinedTale
Contributor II
Contributor II
Author

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

jyothish8807
Master II
Master II

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