2 Replies Latest reply: Oct 26, 2015 9:46 AM by AAA KKK

# Get variable name

Hi everyone !

I have in my Qlikview Ptrojet a population and in this population a number of good people. I wanna to knwo which variable and which selected modality increase the most the percentage of my good people in the all population. Every one is identified with an ID.

For exemple: if i have the variable : Hapiness with two modality 'high' 'low' so Hapiness= high or low

and a second variable Money= 'lot of' or 'few', the i would like to know which of the following percent is the highest :

- Count( if [Person]='Good' and [Hapiness]='high', ID)) / Count (if ( [Hapiness]='high' , ID))

- Count( if [Person]='Good' and [Hapiness]='low', ID)) / Count (if ( [Hapiness]='low' , ID))

-Count( if [Person]='Good' and [Money]='lot of', ID)) / Count (if ( [Money]='lot of' , ID))

- Count( if [Person]='Good' and [Money]='few', ID)) / Count (if ( [Money]='few' , ID))

I though about saving this percentage in varibales and use RangeMax(Var1,Var2,Var3,Var4) where Var1=HapineesHigh, Var2=HapinessLow ....but this fonction return just the percentage and not the name of the variable/modality, so i can't know which variable and which of its modality is the more discriminent.

How can i do ?

Thank's

Am'

• ###### Re: Get variable name

Try like below:

1. Dual('HappinessHigh', Count( if [Person]='Good' and [Hapiness]='high', ID)) / Count (if ( [Hapiness]='high' , ID)) )

2. Dual('HappinessLow', Count( if [Person]='Good' and [Hapiness]='low', ID)) / Count (if ( [Hapiness]='low' , ID)) )

3. Dual('MoneyLot', Count( if [Person]='Good' and [Money]='lot of', ID)) / Count (if ( [Money]='lot of' , ID)) )

4. Dual('MoneyFew', Count( if [Person]='Good' and [Money]='few', ID)) / Count (if ( [Money]='few' , ID)) )

Use RangeMaxString() function to get the respective variable name.

RangeMaxString( var1. var2, var3, var4 )

• ###### Re: Get variable name

Thank you very much !!!

Do you know how to get the second best % , the third one.. please ??