Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
cpetti04
Contributor
Contributor

Unable to get syntax correct when using aggr with set analysis expression

I am fairly inexperienced with qlikview so forgive my ignorance.  I have trying to resolve an issue with row totals on a pivot table being incorrect.  I found other solutions to state that this can be resolved by using the aggr function however I cannot seem to get syntax write on the expression used for these totals.  Below is example of existing expression.

if(mydata.type='PERSONS',sum({<NAME_CODE={'VI'},approvals.APPROVAL_LEVEL={">1"},DISPOSITION={"*"}-{'1'},case.PART={'1','2'}>}CNT),
COUNT({<CHRGCNT={'1'},approvals.APPROVAL_LEVEL={">1"},DISPOSITION={"*"}-{'1'},case.PART={'1','2'}>}DISTINCT LWMAINID))

I have tried adding in a few places but always highlights as incorrect.

1 Solution

Accepted Solutions
sunny_talwar

What all dimensions do you have in your chart... assuming your dimensions are dim1 and dim2... you can try this

Sum(Aggr(
  If(mydata.type = 'PERSONS',
    Sum({<NAME_CODE={'VI'},approvals.APPROVAL_LEVEL={">1"},DISPOSITION={"*"}-{'1'},case.PART={'1','2'}>}CNT),
    Count({<CHRGCNT={'1'},approvals.APPROVAL_LEVEL={">1"},DISPOSITION={"*"}-{'1'},case.PART={'1','2'}>}DISTINCT LWMAINID)
) , Dim1, Dim2))

View solution in original post

3 Replies
tincholiver
Creator III
Creator III

just add

aggr(
if(mydata.type='PERSONS',sum({<NAME_CODE={'VI'},approvals.APPROVAL_LEVEL=
{">1"},DISPOSITION={"*"}-{'1'},case.PART={'1','2'}>}CNT),
COUNT({<CHRGCNT={'1'},approvals.APPROVAL_LEVEL={">1"},DISPOSITION={"*"}-{'1'},case.PART={'1','2'}>}DISTINCT LWMAINID)),
yourdimension1,yourdimension,etc)

those dimensions are those that accumulate the values and must be in the dimensions of the graph
sunny_talwar

What all dimensions do you have in your chart... assuming your dimensions are dim1 and dim2... you can try this

Sum(Aggr(
  If(mydata.type = 'PERSONS',
    Sum({<NAME_CODE={'VI'},approvals.APPROVAL_LEVEL={">1"},DISPOSITION={"*"}-{'1'},case.PART={'1','2'}>}CNT),
    Count({<CHRGCNT={'1'},approvals.APPROVAL_LEVEL={">1"},DISPOSITION={"*"}-{'1'},case.PART={'1','2'}>}DISTINCT LWMAINID)
) , Dim1, Dim2))
cpetti04
Contributor
Contributor
Author

Thank you very much this resolved my issue appreciate quick response.