Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

beck110979
Valued Contributor III

Only () for content of fields

Hi Folks, i have the following data-structure,

Info,         Typ,      Sales,

ABC1,      FK          100

ABC2,      FK          150

ABC3,      EK          220

ABC4,      DK          180

if i want to know the sum of  Typ = FK , so then i am using: the set expression like

Sum({<Typ ={'FK'}>}Sales) and my result does look like > Sum of FK = 250 and it does work well,

my issue is, that i have a lot of data, and i want to know the content of fields , like Info


for example: Only(Sum({<Typ ={'FK'}>}Sales)) and i want to display the fields with Info: ABC1, ABC2 but it does not work.


Does anybody have any idea, how to show the content of fields of Info on the base of fields of Typ, Sales


Thanks a lot

Beck

15 Replies
sureshqv
Esteemed Contributor III

Re: Only () for content of fields

try this

aggr(Only(Sum({<Typ ={'FK'}>}Sales)),info)

beck110979
Valued Contributor III

Re: Only () for content of fields

Hi Chanty,

thanks a lot for your responce, but this expresssion does not work,

i want to use such expression in listbox (Qlik Sense) like a filter.

Do you have any idea?

Thanks a lot

Beck

devarasu07
Honored Contributor II

Re: Only () for content of fields

Hi,

only will return the distinct value, so try like this

only(aggr(Sum({$<Typ ={'FK'}>}Sales),Info))

Capture.JPG

for your listbox expression like this

=if(Typ='FK',Info) or

=if(aggr(Sum({$<Typ ={'FK'}>}Sales),Info),Info)

sureshqv
Esteemed Contributor III

Re: Only () for content of fields

if you use that exp in listbox what your getting?

beck110979
Valued Contributor III

Re: Only () for content of fields

i want to see the content like: ABC1. ABC2

MVP
MVP

Re: Only () for content of fields

The Aggr() is redundant here (and possibly quite expensive to calculate).


Sum({<Typ ={'FK'}>} Sales) as an expression with Info as a dimension will produce the same result as the Aggr().

Please do not clutter the expressions with unnecessary operations. Test the simple operations first.

devarasu07
Honored Contributor II

Re: Only () for content of fields

hi,

pfa for qliksense sample

another way u can simple create table in sense

Dimension:

Info,

Type

Measure

Sum({$<Typ ={'FK'}>}Sales) // best approach and avid using aggr inside measure

Capture.JPG

beck110979
Valued Contributor III

Re: Only () for content of fields

Hi Devarasu,

can i use this expression in listbox like a filter, i mean, if i open the the app, then i want to see on the left-handside the litbox like a filer with contents with only: ABC1, ABC2 and if i select ABC1. then i see in the table the sum: 100

Thanks a lot

Beck

ashwinishinde
New Contributor III

Re: Only () for content of fields

=if(Typ='FK',Info)

listbox.png