Qlik Community

Ask a Question

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Welcome to our newly redesigned Qlik Community! Read our blog to learn about all the new updates: READ BLOG and REPORTED ISSUES
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor III
Contributor III

Sum of aggr function

Hi,

I have a QV table with an expression that looks like below.

As you can see from the picture it doesn't seem to add upp in the column total and I can't figure out why.

The expression looks like this:

MålkortsDatum = Date formated as YYYY-MM-DD

SVDate (Variable) = 2018-10-30

SlutprognosAnsvar = number column (data from excelfile)

ProjektNr = number column (data from excelfile)

AnsvarNr = number column (data from excelfile)

FirstSortedValue({$<MålkortsDatum={"<$(SVDate)"}>} distinct aggr(Sum({1<MålkortsDatum={"<$(SVDate)"}>}SlutprognosAnsvar), ProjektNr, AnsvarNr, MålkortsDatum),-MålkortsDatum)

1 Solution

Accepted Solutions
Contributor III
Contributor III

Thank you for the information Stefan,
I ended up rewriting the expression after getting a better understanding of the expressions and this is the end result:

Sum({$<MålkortsDatum={"<$(SVDate)"}>}AGGR(FirstSortedValue(SlutprognosAnsvar, -MålkortsDatum), ProjektNr, AnsvarNr))

View solution in original post

4 Replies
MVP
MVP

If you say 'add up' that means you want a sum of rows in your pivot table?

https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/ChartFunctions/NestedAgg...

Try adding the the Sum(Aggr(..., YourChartDimensions)) like

=Sum({$<MålkortsDatum={"<$(SVDate)"}>} Aggr(

FirstSortedValue({$<MålkortsDatum={"<$(SVDate)"}>} distinct aggr(Sum({1<MålkortsDatum={"<$(SVDate)"}>}SlutprognosAnsvar), ProjektNr, AnsvarNr, MålkortsDatum),-MålkortsDatum)

,ProjektNr, AnsvarNr))

Contributor III
Contributor III

That is awesome!
Why does it work when using a second aggr argument?

MVP
MVP

Contributor III
Contributor III

Thank you for the information Stefan,
I ended up rewriting the expression after getting a better understanding of the expressions and this is the end result:

Sum({$<MålkortsDatum={"<$(SVDate)"}>}AGGR(FirstSortedValue(SlutprognosAnsvar, -MålkortsDatum), ProjektNr, AnsvarNr))

View solution in original post