Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Marcel_Garcia
Contributor III
Contributor III

Variable assigns a constant to each value of a field

Hi all.
I have a variable that calculates the rate of something for a period of time (Previous 13 Weeks):

=Sum({<PRE_POST_WEEKS={[>-13 <0]}>}SALES_VOLUME) / Sum({<PRE_POST_WEEKS={[>-13 <0]}>} CALLS_VOLUME)

Problem is that I need to calculate this 'constant' for each for each SALES_PERSON, so each person has an assign constant in other calculations of my app.
Currently, the variable will assign the same generic constant to all the persons and only when I filter down to one Person I get the right rate.

Example

Currently:                                                                Ideally:
Variable | Person                                                 Variable | Person
0.9                A                                                            0.9            A
0.9                B                                                            0.7            B
0.9                C                                                            0.4            C

Any Ideas?

Labels (3)
1 Solution

Accepted Solutions
Handel
Partner - Contributor
Partner - Contributor

Hi Marcel,

To aggregate to a certain level try using aggr -function:

=Aggr(Sum({<PRE_POST_WEEKS={[>-13 <0]}>}SALES_VOLUME) / Sum({<PRE_POST_WEEKS={[>-13 <0]}>} CALLS_VOLUME), Person)

View solution in original post

1 Reply
Handel
Partner - Contributor
Partner - Contributor

Hi Marcel,

To aggregate to a certain level try using aggr -function:

=Aggr(Sum({<PRE_POST_WEEKS={[>-13 <0]}>}SALES_VOLUME) / Sum({<PRE_POST_WEEKS={[>-13 <0]}>} CALLS_VOLUME), Person)