# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save \$300 before February 6: REGISTER NOW!
cancel
Showing results for
Did you mean:
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
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
4 Replies
Partner - Master III

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?

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
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>))

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

Tags
Community Browser