Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis and current selection

Hi everybody,

I have a button that I've configured in this way :

=Date( Max( {1<Compteur = {$(#=Only(Compteur))}>} Date ) )

I've checked the QV Help and the syntax seems to be fine. One detail, Compteur contains text eg. : "Disjoncteur Général"

Does somebody has any idea ?

Thank you

set_analysis_1.jpg

1 Solution

Accepted Solutions
Not applicable
Author

Hi, I think the problem is that Compteur is a string field and you are trying to cast the string to a number by using $(#=) the pound sign before the equal sign, hence the expression should work written like this:

=Date( Max( {1<Compteur = {'$(=Only(Compteur))'}>} Date ) )

Also rembember, the only function will return a value in the case that only one value is possible, otherwise it will return null.

Regards

View solution in original post

5 Replies
Not applicable
Author

Hi, I think the problem is that Compteur is a string field and you are trying to cast the string to a number by using $(#=) the pound sign before the equal sign, hence the expression should work written like this:

=Date( Max( {1<Compteur = {'$(=Only(Compteur))'}>} Date ) )

Also rembember, the only function will return a value in the case that only one value is possible, otherwise it will return null.

Regards

erichshiino
Partner - Master
Partner - Master

Does it work outside that search string box? In a text box for example?

You probably need quotes around the compteur:

=Date( Max( {1<Compteur = {'$(#=Only(Compteur))'}>} Date ) )

or

=Date( Max( {1<Compteur = {"$(#=Only(Compteur))"}>} Date ) )

Regards,

Erich

Not applicable
Author

Thank you Ivan and Erich,

It works when I combined what you told me (without # and with " "):

=Date( Max( {1<Compteur = {"$(=Only(Compteur))"}>} Date ) )

Thank again guys !

Not applicable
Author

Jeremy, just as a small suggestion, avoid using double quotes when possible, since it will invoke the qv search engine and it might have some performance implications. I always use single quotes, when I am filtering by a literal field value.

Regards

erichshiino
Partner - Master
Partner - Master

Good to know that Ivan!

Thanks!

Erich