Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum values based on a count in an expression

Hi,

With the following expression I simply count values based on some string values of the dimension data:

=count({$<data={'value a', 'value b'}>}profile.id)

However, I want to sum these two values in this expression and not through the 'expressions - Full Accummulation', or the 'Total Mode - sum of rows'.

I tried it with rangesum and aggr, but with no success. Can anyone help?

Thanks in advance!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Maybe this:

sum(aggr(count({$<data={'value a', 'value b'}>}profile.id), MyChartDimension1, MyChartDimension2, ... etc ))

Replace MyChartDimension1, MyChartDimension2, ... etc with the names of the dimensions in your chart.

If that isn't what you need, see here and here.



talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Maybe this:

sum(aggr(count({$<data={'value a', 'value b'}>}profile.id), MyChartDimension1, MyChartDimension2, ... etc ))

Replace MyChartDimension1, MyChartDimension2, ... etc with the names of the dimensions in your chart.

If that isn't what you need, see here and here.



talk is cheap, supply exceeds demand
Not applicable
Author

Thanks! I had tried this expression before too, but I forgot to remove the dimension data, so I always got two results and no accumulation.

Not applicable
Author

Hey guys,

I find this discussion helpful and I seem to have a similar problem. Basically I need to find the SUM of all employees in a company that has offices in different countried. A country is represented by Country ID and each employee has an employee ID. I need to count all employees in each country and sum up all employees. here is my equition that is giving me an error

='No. of Emp = ' &count({< [Country ID] = {'CI-005'} >}  distinct [Emp ID]),  count({< [Country ID] = {'CI-008'} >}  distinct [Emp ID])

Can someone here help to tell me whats wrong?