Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum of a sum

Hello,

I building a table with P&L values and i want to present the cumulative sum of all the groups except the taxes one in one row of the table.

I start with this but i get no result.

if (PresentatieVolgorde.Group like 'Value before taxes',

          if (PresentatieVolgorde.group = 'taxes',

                  sum(  aggr( Sum ([P&L Detail.Value]),Boeking)))

Can someone please help me?

Best regards

Piskitta

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I am still guessing, because I don't really know your data model.

If you want to exclude value 'taxes' from field group, you could either use an if with comparison on non equal,

=sum(  aggr( Sum ( if(PresentatieVolgorde.group <> 'taxes', [P&L Detail.Value])),Boeking))

or using set analysis.

=sum(  aggr( Sum ( {<PresentatieVolgorde.group -= {'taxes'} [P&L Detail.Value]),Boeking))

I am a little confused, because you are using field names with slightly different spelling, or with / without table qualifier, so I am not sure if this is a problem or wanted.

View solution in original post

5 Replies
swuehl
MVP
MVP

You probably need to include the check for values inside your aggregation, maybe like

=sum(  aggr( Sum ({<PresentatieVolgorde.group = {'taxes'},PresentatieVolgorde.Group = {'Value before taxes'} >}  [P&L Detail.Value]),Boeking)))

These two fields group and Group are really different fields, right?

Not applicable
Author

=if (PresentatieVolgorde.Kostengroep = PresentatieVolgorde.Boeking , aggr( sum ([P&L Detail.Value]),...

This is the expression that i'm using to calculate all the other values.

I get as a result the values from groups because they are the same code:

     PresentatieVolgorde.Kostengroep = PresentatieVolgorde.Boeking

But now i need to sum all of the groups except taxes.

I get no result no matter what i try...

Sorry

kind regards

Piskitta

swuehl
MVP
MVP

I am still guessing, because I don't really know your data model.

If you want to exclude value 'taxes' from field group, you could either use an if with comparison on non equal,

=sum(  aggr( Sum ( if(PresentatieVolgorde.group <> 'taxes', [P&L Detail.Value])),Boeking))

or using set analysis.

=sum(  aggr( Sum ( {<PresentatieVolgorde.group -= {'taxes'} [P&L Detail.Value]),Boeking))

I am a little confused, because you are using field names with slightly different spelling, or with / without table qualifier, so I am not sure if this is a problem or wanted.

Not applicable
Author

Thanks Stefan.

I was typing wrong. But now it works...

Best regards

Piskitta

Not applicable
Author

A little off-topic...did anyone else see this thread title and think "Sum of a sum of a sailor"?