Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Uploads getting stuck in the virus scanner. We are investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Using probabilities as measure and as a dimension

I'd like to use probabilities as measure and as a dimension.
 
If we have a binary column gender, expressed a probability of being female, like the next one having four times 1.0, ten times 0.9 and one time 0.0:
 
  is_female
  ---------
        1.0
        1.0
        1.0
        1.0
        0.9
        0.9
        0.9
        0.9
        0.9
        0.9
        0.9
        0.9
        0.9
        0.9
        0.0
 
I'd like to have a bar chart with the rounded sum.
 
In this case it should show: 13 women and 2 men.
 
I'm using the next measure, which behaves as expected:
 
=round(Sum(is_female))+round(Sum(1-is_female))
 
Which dimension could I use?
 
If I use 'is_female' as dimension, it thinks that 0.9 is another categorical value.
 
If I use round(is_female), it counts the 0.9 occurrences as ten women.  Instead of 9 women + 1 man.
 
Thanks in advance
Cheers,
1 Reply
Highlighted
Contributor III
Contributor III

I solved it by detaching the info into two columns:  gender and gender_prob.
 
So, one original row can be detached into two new rows, one for female and the other one for male.
 

 

gender_prob     gender
-----------     ------
        1.0          F
        1.0          F
        1.0          F
        1.0          F
        0.9          F
        0.1          M
        0.9          F
        0.1          M
        0.9          F
        0.1          M
        0.9          F
        0.1          M
        0.9          F
        0.1          M
        0.9          F
        0.1          M
        0.9          F
        0.1          M
        0.9          F
        0.1          M
        0.9          F
        0.1          M
        0.9          F
        0.1          M
        0.0          M

 

 
Now, I can use gender as dimension and sum(gender_prob) as measure