Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

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 ?

Please help me

Thank's

Am'

Tags (2)
1 Solution

Accepted Solutions
Not applicable

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 )

2 Replies
Not applicable

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 )

Not applicable

Re: Get variable name

Thank you very much !!!

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

Community Browser