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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Chi square histogram and dynamic aggregation

Hi Everybody,

I am trying to build a histogram of p- and chi2-values from a chi square test, that uses a dynamically calculated "Count" column to show possible associations between a pre-selectable risk faktor and a number of diseases as the diagram dimension. It works pretty much fine with static input data (see attached QVW file for an example). The individual level data is not included in the file for privacy reasons.

Is there *any* way of calculating the "Count" column dynamically - based on the selection of the individual level data? I tried using the "total" keyword and the aggr() function, but couldn't get it going. After some days of trial- and error I hope, that some of you guys can help me! !

Thanks in advance

Helmut

1 Solution

Accepted Solutions
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Here you go. I used AGGR to count the IDs at the same detailed level as the table suggests:

Chi2Test_p(

    DiseasePresent,

    RiskLevel,

    aggr(

          COUNT(DISTINCT  AnonId),

          DiseaseName, DiseasePresent, RiskFactor, RiskLevel)

)

cheers,

Oleg Troyansky

Come to the Masters Summit for QlikView and learn Advanced Aggregation and Advanced Set Analysis with me!

Ask me about Qlik Sense Expert Class!

View solution in original post

4 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Helmut,

based on the Help description of the function, you should be able to use the calculated Count, with either the TOTAL qualifier, or using AGGR(). In both cases, you should use your Chart dimension as the aggregation dimension.

I'd be happy to show you how to do it, but I need the data that you are going to count. You can either scramble the original data, or simply build a manual mock-up example with the corresponding fields.

cheers,

Oleg Troyansky

Come to the Masters Summit for QlikView and learn Advanced Aggregation and Set Analysis with me!

Ask me about Qlik Sense Expert Class!
Not applicable
Author

Hi Oleg,

thanks for the fast response. Indeed, that help entry gave me some hope about being able to do what I need, giving the hints for the usage of TOTAL and AGGR, but I couldn't find any detailed information about how nor any examples.

What you write gives me so hope!

I prepared a mock-up example for you (ChiSquareHistogram_v2.qvw). It contains

  • a chart based on the static occurence counts (trivial, but it shows, how I imagine the result)
  • a second, halfway configured, chart that is supposed to calculate it's p-values based on dynamic occurence counts (which, for instance, can change as the number of selecterd individuals change)

The second, defunct, chart is the one I need your help on!

Cheers

Helmut

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Here you go. I used AGGR to count the IDs at the same detailed level as the table suggests:

Chi2Test_p(

    DiseasePresent,

    RiskLevel,

    aggr(

          COUNT(DISTINCT  AnonId),

          DiseaseName, DiseasePresent, RiskFactor, RiskLevel)

)

cheers,

Oleg Troyansky

Come to the Masters Summit for QlikView and learn Advanced Aggregation and Advanced Set Analysis with me!

Ask me about Qlik Sense Expert Class!
Not applicable
Author

Hi Oleg,

that's great. Exactly what I needed!

My mistake when trying to use the aggr() was that I was trying to find a way to make it deliver just a single column.

Thanks a bunch!!!