Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

little help with expression

Hi

I'm trying to sum the total of all work, but I have issue as we have some records which are listed multiple times in a table, as in this example:

  

Work Request CodeWorks DescriptionEngineer WR AveEstimateCost
57377xxxxxA £                              64.64
60873xxxxxxA £                              35.77
66287xxxxxxxxA £                            140.83
71689xxxxxxxxxA £                              67.30
73699sdgfg fgdgA £                              67.30
73700fgfdg  hggh hA £                              67.30
73697h dhg hgfhgf hhf A £                              67.30
73697h dhg hgfhgf hhf B £                              67.30

we always show duplicate rows where a work request has more than one engineer assigned to it, and generally this is correct in our qlikview model.

but in a text box I'm trying to total up the sum of the work using the following expression:

=sum({<status_cat={'open'}, problem_cat={'reactive'}>} [WR AveEstimateCost])

this gives a result of £577,74.  But I only want it to add up for each unique work request code and get the result, which in this example, should be £510.44

I've tried adding Distinct [Work Request Code] into the expression and also use Aggr, but I'm either not getting it in the right place or using the correct syntax/set analysis etc

can anyone help?

1 Solution

Accepted Solutions
rubenmarin

Hi Dan, maybe with:

=sum({<status_cat={'open'}, problem_cat={'reactive'}>} Aggr([Min/Max/Distinct/...]([WR AveEstimateCost]), [Work Request Code))

View solution in original post

3 Replies
gautik92
Specialist III
Specialist III

distinct wil work for sure

rubenmarin

Hi Dan, maybe with:

=sum({<status_cat={'open'}, problem_cat={'reactive'}>} Aggr([Min/Max/Distinct/...]([WR AveEstimateCost]), [Work Request Code))

Not applicable
Author

worked with

=sum({<status_cat={'open'}, problem_cat={'reactive'}>} Aggr(DISTINCT ( [WR AveEstimateCost]), [Work Request Code]))


Thanks!!