Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

fmazzarelli
Contributor III

howto: sum a data list

Hi Community,

could you help me?

A table contains these values:

Name                     Number

BOOK 1      ........... 20

BOOK 2 ................. 4

A12345 ...............    34

G45677 .................. 3

901020 ................   34

FRUIT ................. 34

DISK ..................  123

H12497 ..............    3

HowTo sum only:

A12345

G45677

901020

H12487

11 Replies
MVP
MVP

Re: howto: sum a data list

May be this:

Sum({<Name = {'A12345', 'G45677', '901020', 'H12487'}>}Number)

fmazzarelli
Contributor III

Re: howto: sum a data list

Hi,

t is more complicated because I do not know the list of items to be added. I could use a formula that allows to recognize that the value contains numbers.

So that,

if the value contains a high number otherwise not rule it out.

cludo.

Re: howto: sum a data list

Try to give Condition on Number


Sum({<Number= {"<=34"}>}Number)

MVP
MVP

Re: howto: sum a data list

How about this:

Sum({<Name = {"=Len(KeepChar(Name, '0123456789')) > 0"}>}Number)


Sum({<Name = {"=KeepChar(Name, '0123456789') * 1 > 10"}>}Number)

MVP
MVP

Re: howto: sum a data list

Wouldn't this Sum DISK also?

fmazzarelli
Contributor III

Re: howto: sum a data list

perfect.

MVP
MVP

Re: howto: sum a data list

So which of the solutions finally worked?

fmazzarelli
Contributor III

Re: howto: sum a data list

Hi

the solutions finally worked is

Sum({<Name = {"=KeepChar(Name, '0123456789') * 1 > 10"}>}Number)


Now,

may I group them in a linear table?

A12345 10

G45677 20

901020  5

H12487  50

NewName  = 85

NewName is the sum of A12345, G45677, 901020, h12487

Re: howto: sum a data list

Create Straight table

Dimension:

=Valuelist('NewName1','NewName2')

Expression:

=Pick(Match(Valuelist('NewName1','NewName2'),'NewName1','NewName2'),

Sum({<Name = {"=KeepChar(Name, '0123456789') * 1 > 10"}>}Number),

Sum({<Name = {"=KeepChar(Name, '0123456789') * 1 > 20"}>}Number))