Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sangeeth8787
Contributor III
Contributor III

How to use sum and first sorted value together

Hi,

 

I have used first sorted function to find out first sales of month for a particular region/state, In Pivot chart I need to add each state value( result of : firstsortedvalue(Sales, Txn_Dt)) to the country level and continent level or few other dimensions. 

When I try the following expression, it is resulting Null

 

sum(FirstSortedValue(Sales,Txn_Dt) .

 

It would be great if any could share your thoughts if you aware of such scenarios how to handle them.

 

Thanks

 

Sangeeth

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

You can't nest aggregation functions directly like that. You can do this:

sum(Aggr(FirstSortedValue(Sales,Txn_Dt), <Some dimension>))

Where <Some dimension> are one or more fields by which the FirstSortedValue will be calculated.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

4 Replies
agigliotti
Partner - Champion
Partner - Champion

Hi,
i noted in your expression one bracket is missing: sum(FirstSortedValue(Sales,Txn_Dt) )
anyway how does your pivot chart looks like and what's your expected result?
could you share an example with data?

jonathandienst
Partner - Champion III
Partner - Champion III

You can't nest aggregation functions directly like that. You can do this:

sum(Aggr(FirstSortedValue(Sales,Txn_Dt), <Some dimension>))

Where <Some dimension> are one or more fields by which the FirstSortedValue will be calculated.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sangeeth8787
Contributor III
Contributor III
Author

Hi,

 

I am glad for your message, Thanks for correcting syntax. I have managed to find the solution.

 

If we want to use sum and Firstsortedvalue  

 

Sol: Sum(Aggr(FirstSortedValue(Value,<SortingObject>),<Dimension1>,<Dimension2>))

 

sangeeth8787
Contributor III
Contributor III
Author

If we have cyclic groups in Chart, do we need to mention all dimensions which involved in cyclic groups in place of dimensions?

 

Thanks

Sangeeth