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: 
kgraham25
Contributor II
Contributor II

Set analysis on a dimension that's in your aggr function

Hi

I have the following aggr function which allows my data to be weighted (my weighting factors are dependent on country, dataset and revenue of respondent) and to look at the percentage of responses to Question 701 in my dataset. My dataset is loaded into Qlik in a table for Questions, a table for Responses and a table for Demographics.

SUM(AGGR(

(COUNT (DISTINCT {<QuestionID={'701'}>} InterviewID)

    /

$(vWeightedBase)

    )

    *

    [Weighting factor]

    ,Country,Dataset,Response,[Revenue Group])

)

Where vWeightedBase is:

=SUM(AGGR(COUNT(DISTINCT {<QuestionID = {'701'}>} InterviewID)

*[Weighting factor],

Country,Response,Dataset,[Revenue Group]))

This function has been working well and has produced the results that I expected. However, I now want to look at this in more detail and use set analysis to filter on certain responses only - as follows:

SUM(AGGR(

(COUNT (DISTINCT {<QuestionID={'701'}, Response={'Company1'}>} InterviewID)

    /

$(vWeightedBase)

    )

    *

    [Weighting factor]

    ,Country,Dataset,Response,[Revenue Group])

)

Where vWeightedBase is:

=SUM(AGGR(COUNT(DISTINCT {<QuestionID = {'701'},Response-={'No answer'}>} InterviewID)

*[Weighting factor],

Country,Response,Dataset,[Revenue Group]))

My function is no longer working correctly and my numbers are way out. Is this something to do with the fact that I'm trying to filter on a dimension that I'm aggregating over?

Any help would be great!

Thanks

KG

2 Replies
sunny_talwar

Difficult to know, would you be able to share a sample to check this out?

rubenmarin

Hi Kelly, in cae the external aggr is filtering values I would try to set vWeightedBase as:

=SUM({<QuestionID = {'701'},Response-={'No answer'} AGGR(COUNT(DISTINCT {<QuestionID = {'701'},Response-={'No answer'}>} InterviewID)

*[Weighting factor],

Country,Response,Dataset,[Revenue Group]))