Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for
Did you mean:
Contributor II

## Set analysis for trend calculation over time

Hi!

I have a measure that calculates a weighted average as such:

``````Sum(
Aggr(
\$(vL.Channel1Weighted)
+
\$(vL.Channel2Weighted)
+
\$(vL.Channel3Weighted)
,
[Company]
))
/
Sum(ChannelWeight)``````

So it calculates the weighted averages of the different channels and aggregates the results according to the company.

The variables are calculated as following:

``````(sum({<NPSPlus={1}, [Channel1]={1}>}[NPS_count])
-
sum({<[NPSMinus]={1}, [Channel1]={1}>}[NPS_count]))
/
sum({<[Channel1]={1}>}[NPS_count])
*100
*Sum({<[Channel1]={1}>}ChannelWeight)``````

I should now have a measure for a line chart showing trend over time with at least month, quarter and year and it should work with the company and channel selections that the users can make freely. The default is 5/5 companies, but you should be able to select any combinations freely. Same with the different channels. The channels have different weights and all 5 companies can select them for themselves and the ChannelWeight is in the data model correct for each company/channel combination.

So my problem is, that I am unsure what to use in my set analysis. There is a master calendar in the app with a key value plus: year, quarter, month selections.

Labels (1)
• ### General Question

2 Replies
Employee

Is the date range of the trend limited by anything other than user selections?  If not, just make the chart dimension the desired calendar field.  You might use a variable picker drop-down (see bundled extensions) to let the user pick Year|Quarter|Month and populate the variable with the appropriate dimension field name.  Then use the variable in the chart dimension.

Contributor II
Author

Thank you for the reply! However, the trend line shows incorrectly. The values do not match when users make selections. For example, the user selects last month for only one of  the companies and the value on the trend is fine. When more than one company or more than one month is selected, the values on the trend line are not correct.