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

Sum of just one value in field

Hello guys,

I have a problem, i want to sum just one value in a table.

I use this expression:

=sum(if(Aggr(Rank(sum({$<FABRICANTE-={'Name of field to exclude'}, %Measure_N={'€sP','€cP'}, %Time.Type={'CP'}, Marca=>}Valor))=1,Valor, CATEGORIA),Valor))

im try to saying that i want the value from the number 1 in rank, whitout the name of a specific manufacturer, but e want to sum the value of the manufacturer that is in the first place.

I want to sum the value in yellow, but the expression just gives me the full amount that is 1941274, that is the sum of the 3 lines.

any one can help?

tnks!

PCordeiro

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I think you should be able to do this, you probably just need to ignore selections in CATEGORY / FABRICANTE in your aggregation:

=Max( TOTAL

     {$<CATEGORIA=, FABRICANTE-={'Name of field to exclude'}, %Measure_N={'€sP','€cP'}, %Time.Type={'CP'}, Marca=>}

    Aggr(

          sum({$<CATEGORIA=, FABRICANTE-={'Name of field to exclude'}, %Measure_N={'€sP','€cP'}, %Time.Type={'CP'}, Marca=>} Valor)

            ,CATEGORIA, FABRICANTE // add here all dimension fields of your chart

    )

)

View solution in original post

16 Replies
Not applicable
Author

Capture.JPG

sunny_talwar

Try this:

=Sum(If(Aggr(Rank(sum({$<FABRICANTE-={'Name of field to exclude'}, %Measure_N={'€sP','€cP'}, %Time.Type={'CP'}, Marca=>}Valor), 1, 1) < 2, CATEGORIA), Valor))

Not applicable
Author

its not working! i have tryed that one as well!

my problem is that i have done this to show me the 1st seller with this expression:

=if( CATEGORIA = 'Name of cagtegory to exclude if', '- '

,Aggr(if(Rank( Sum( {<FABRICANTE-={'Name of field to exclude'}>}  Valor))=1,  FABRICANTE),CATEGORIA,FABRICANTE))

but now i want the value of that 1st, witch is 1562654.. but with no success!

sunny_talwar

How about this:

=Max(If(Aggr(Rank(sum({$<FABRICANTE-={'Name of field to exclude'}, %Measure_N={'€sP','€cP'}, %Time.Type={'CP'}, Marca=>}Valor), 1, 1) < 2, CATEGORIA), Valor))

swuehl
MVP
MVP

Or maybe

=Max( {$<FABRICANTE-={'Name of field to exclude'}, %Measure_N={'€sP','€cP'}, %Time.Type={'CP'}, Marca=>}

    Aggr(

          sum({$<FABRICANTE-={'Name of field to exclude'}, %Measure_N={'€sP','€cP'}, %Time.Type={'CP'}, Marca=>} Valor)

            ,CATEGORIA, FABRICANTE // add here all dimension fields of your chart

    )

)

swuehl
MVP
MVP

And please specify in which context you are trying to get your result.

If it's in the chart itself, you might need to add a TOTAL qualifier:

=Max( TOTAL

     {$<FABRICANTE-={'Name of field to exclude'}, %Measure_N={'€sP','€cP'}, %Time.Type={'CP'}, Marca=>}

    Aggr(

          sum({$<FABRICANTE-={'Name of field to exclude'}, %Measure_N={'€sP','€cP'}, %Time.Type={'CP'}, Marca=>} Valor)

            ,CATEGORIA, FABRICANTE // add here all dimension fields of your chart

    )

)

Not applicable
Author

Its worked, but i have other values that if i choose the Category, the value is the MAX, but i want the value of the 1st manufacturer in rank, its not going to work with MAX.

my problem is that i have done this to show me the 1st seller with this expression:

=if( CATEGORIA = 'Name of cagtegory to exclude if', '- '

,Aggr(if(Rank( Sum( {<FABRICANTE-={'Name of field to exclude'}>}  Valor))=1,  FABRICANTE),CATEGORIA,FABRICANTE))

but now i want the value of that 1st RANK, witch is 1562654.. but with no success!

swuehl
MVP
MVP

Not sure if I can follow your explanations, could you post a small sample QVW or at least some more screenshots that clearly show what you are trying to exclude and include in your aggregation?

Not applicable
Author

Capture.JPG

i have this table, and i want the value of the 1st rank, if i choose other manufacturer or category, the show me the max value. but i want the value of the first ones. in this case is 1562654.

her is another example

In this case is the 68981.

i just want the first value of the number one in the rank, with MAX i cant get it.

tnks

regards

PCordeiro