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: 
josephinetedesc
Creator III
Creator III

My Aggr or set analysis problem

Hi All

I have been trying to do get a total total cost:

     

ClassTypeClassTypeDesccostWeightNo.RecsCost($)
Total 293
SimOPS11.51$1.50
OPS32.7143$116.53
OPSL43.3592$308.20

The formula for getting the no of Records is

count(distinct{<ClassTypeName = { 'Sim'}>}([RecNo()]))

How do I get the total COST which is costWeight * No. Recs

I have read about aggr function but I do not know where to apply the function.

Thank you for any help you can give.

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Like this:

=Sum(Aggr(costWeight * Count({<ClassTypeName = { 'Sim'}>} DISTINCT RecNo()]), ClassType, ClassTypeDesc))

If this is in a chart with more dimensions, then you need to include all the chart dimensions in the list of dimensions for the Aggr()

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

View solution in original post

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Like this:

=Sum(Aggr(costWeight * Count({<ClassTypeName = { 'Sim'}>} DISTINCT RecNo()]), ClassType, ClassTypeDesc))

If this is in a chart with more dimensions, then you need to include all the chart dimensions in the list of dimensions for the Aggr()

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

Thank you Jonathan - worked beautifully,

Now all I have to do is study it and figure out why

Thanks again

Jo