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: 
Not applicable

How to use Khi 2 test dynamically ?

Hello !

I have a problem with khi 2 test on QlikView :

     -I would like to compare two selections, in each selection, we have a number of consumers N1 for first selection, N2 for the second one.  among them there is a number of best customers (n1 fo the first selection and n2 for the second one). I would like to know if selection 1 is significatively better than selection 2, if it contains more best customers  (what i mean by selection is when you select different options in the qlikview project, for exemple : age, sex...)


     -I thought about using the khi 2 test. The problem is that the syntaxe of this test require a table :

chi2test_p (col, row, observed_value [, expected_value])

The first idea i had is to write 'col ' and 'row' like a list :  chi2test_p( ('selection1', 'selecion2'), ('BestCustomers',' AllCustomers'),(n1,N1),(n2,N2))  but it doesn't work. n1, n2, N1,N2 are dynamics, they changed when we changed selection1 and selection2.


The second idea that i had is to create a dynamique table so i write it like that :


Table:
LOAD * Inline [
Gender, Coin,   Observed, Expected
selection1, BestCustomers,     n1, n2
selection2, AllCustomers,     N1,  N2
]
;

where n1=sum(BestCutomers) for selection 1. but it doesn't work either because when i reload the script, it doesn't take into account the current selection or the saved selections.

I hope my explications are clear. Please help me to find a solution.

Thank you

Am'

0 Replies