# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

## Distinct Count but Sum Total

Hi All,

I was busy creating a test QV document to load as I couldnt find a way to get to the answer I was looking for. When creating the document I managed to figure a way out but it looks messy and Im wondering if there is a better way to do this.

I have attached the QVD with an inline list of what my data looks like.

The Question:

----------------------------------

Agents are logged onto multiple skillsets simulataneously, the logged on time for each skill set would be the same because of this. I want to know what the accumulated logged on time is for an interval of time for all agents logged in. Taking into account that I need the (MAX) logged on time for each agent, not the combined for each agent for each interval.

Cheers,

Byron

1 Solution

Accepted Solutions
New Contributor III

## Distinct Count but Sum Total

I'm not sure, if I have understood you right but maybe the following formula is what you are looking for?

4 Replies
New Contributor III

## Distinct Count but Sum Total

I'm not sure, if I have understood you right but maybe the following formula is what you are looking for?

Not applicable

## Distinct Count but Sum Total

Thanks, this did get me the same answer. Do you mind elaborating a bit on what the aggr function actually does. I tried to use this in my live report and it did not aggregate correctly.

Thanks for your assistance in this regard

Cheers,

Byron

Not applicable

## Distinct Count but Sum Total

Hi Byron,

Aggregation function helps to sum the data based on Dimensions.

In a setanalysis expression, two sums cannot be used

Ex: sum(sum(...)

so in your example

sum(aggr(max(LoggedOnTime),AgentName))

gives the sum of ( sum of maximum of LoggedOnTime based on dimension AgentName)

Hope that helps

Sravan

Not applicable

## Distinct Count but Sum Total

That expains it very nicely. Thank you Sravan