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

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

Problem with Only function

Hi community,

I have a trouble using only function in a chart expression. My dimension is dimension1, and my expression is like:

=sum({<flag={'1'}, dimension2={'$=(Only(dimension1))'}>} Sales)

dimension1 and dimension2 are same format, result of MonthName function in script.

I tried with ' and " and without them, but still not working.

I'd appreciate any help. Thanks.

Marc.

14 Replies
MK_QSL
MVP
MVP

This should work...

=SUM(IF(Country = CountryField and Flag = 1 and dimension1 = dimension2, Sales))

Anonymous
Not applicable
Author

Manish, this expression is exactly what I have...

Anonymous
Not applicable
Author

Manish,

If the values in the isolated tables would be Distinct, it works fine. Anyway, I give up. I'll try from another point of view.

Thanks for your time.

Marc.

MK_QSL
MVP
MVP

Busy with my project... so can't spend much time on this... Can try on coming weekend...

Colin-Albert
Partner - Champion
Partner - Champion

Only() will return a value when the field has just one selected value.

If no values are selected or more than one value is selected then Only() will return Null.

It may be better to use Max() or Maxstring() instead of Only(), as the max expressions will always return a value  whether one value is selected, or multiple values are selected, or no values are selected.