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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
fabio
Contributor III
Contributor III

Valuelist and Aggr

hi,

chart with a dimension:

=ValueList('a','b','c')

and the expression:

if (ValueList('a','b','c')='a',

   'aa',

    if (ValueList('a','b','c')='b',

     'bb',

        if (ValueList('a','b','c')='c',

            'cc' ) ))

work!

the result is a table like this:

a aa

b bb

c cc

i change the expression in this way:

if (ValueList('a','b','c')='a',

   'aa',

   if (ValueList('a','b','c')='b',

   count( 

aggr ( if ( $(vFattProgrEse) =0 and $(vFattProgrEse1) = 0 and  $(vFattProgrEse2) > 0, Count ( distinct ST_CLIENTE)),ST_CLIENTE)

)

,

        if (ValueList('a','b','c')='c',

            'cc' ) ))

the aggr expression count the customers filtered in a certain way. the single expression work in others chart.

But in this chart with the "valuelist dimension" the result is:


a aa

c cc

the 'b' values is missing.

if i change the order in this way:

if (ValueList('a','b','c')='a',

   count( 

aggr ( if ( $(vFattProgrEse) =0 and $(vFattProgrEse1) = 0 and  $(vFattProgrEse2) > 0, Count ( distinct ST_CLIENTE)),ST_CLIENTE)

)

,

   if (ValueList('a','b','c')='b',

'bbì'

        if (ValueList('a','b','c')='c',

            'cc' ) ))

the result is

a 236

b bb

c cc

this work!

why?!?!?

this is just a basic example,to understand how it works

thanks in advance

7 Replies
juleshartley
Specialist
Specialist

I have this same issue - what a nuisance!

swuehl
MVP
MVP

Try

if (ValueList('a','b','c')='a',

   'aa',

   if (ValueList('a','b','c')='b',

   count(

aggr (NODISTINCT if ( $(vFattProgrEse) =0 and $(vFattProgrEse1) = 0 and  $(vFattProgrEse2) > 0, Count ( distinct ST_CLIENTE)),ST_CLIENTE)

)

,

        if (ValueList('a','b','c')='c',

            'cc' )

))

or

if (ValueList('a','b','c')='a',

   'aa',

   if (ValueList('a','b','c')='b',

   count( TOTAL aggr (if ( $(vFattProgrEse) =0 and $(vFattProgrEse1) = 0 and  $(vFattProgrEse2) > 0, Count ( distinct ST_CLIENTE)),ST_CLIENTE)

)

,

        if (ValueList('a','b','c')='c',

            'cc' )

))

Clever_Anjos
Employee
Employee

Are there more dimensions?

Clever_Anjos
Employee
Employee

Would you mind sharing this variables expressions?

vFattProgrEse

vFattProgrEse1

vFattProgrEse2

swuehl
MVP
MVP

Clever, the original thread is 2 years old, I doubt that we get an answer from Fabio.

I've answered to Julian Hartley, using the original expressions.

Clever_Anjos
Employee
Employee

Sorry

juleshartley
Specialist
Specialist

Thanks swuehl, you're right... that does fix it! Unfortunately it then gives me incorrect numbers so I guess I'll need to adjust dataset to only feed single values...