Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
SamuelHaag
Contributor III
Contributor III

Alternative set analysis rangesum()

Hello,

I'm looking for a better solution to the following set analysis:

rangesum(

sum({<
Factory = {0001}
>} [Value1])

*

sum({<
Factory = {0001}
>} [Value2])

 

,

sum({<
Factory = {0003}
>} [Value1])

*

sum({<
Factory = {0003}
>} [Value2])


//and so on
)

What I'm doing here is calculating different values for each factory and then sum them up with rangesum(). This works fine but isn't a good solution. Every time a new factory is added to the data, I have to add the factory to this set analysis. I have already tried different things with the aggr()-function but nothing worked. Maybe someone of you knows a better solution?

 

Thank you so much 

 

Regards

 

Samuel

Labels (2)
3 Replies
Digvijay_Singh

Not sure but may be like this

Sum(Aggr(Sum(Value1)*Sum(Value2),Factory))

SamuelHaag
Contributor III
Contributor III
Author

I already tried that but it didn't work. Guess it already sums up all Factory values in the first Sum(Value1)

Digvijay_Singh

I tried to follow the expression you shared, in that as wll it sums Value1 and Value2 Separately, If you want to first multiply and then sum, may be like this - Sum(Aggr(Sum(Value1*Value2),Factory))

Pl Share sample data and expected results, I am sure someone should be able to help you by using the samples.