Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
summerrain
Contributor III
Contributor III

Set analysis and Count Function

My data set is this:

IDGender
1Female
2Male
3Female
4Male
5Female
6Male
7Female
8Male
9Female
10Male

I have a listbox and two text box:

gender.JPG

Tex box has these expressions:

='Female: '&count( {$<Gender={'Female'}>} ID)

='Male: '&count( {$<Gender={'Male'}>} ID)

I am wondering If anybody knows why set analysis doesn't work here: If I choose Female in the list box it still shows 5 Male in the text box. I know I can achieve correct count with getselectedcount function, but what to do If I want to use set analysis and that it would take into account all the selections? I though $ symbol should do the trick, but id doesn't in this case.

Please also see the app attached.

1 Solution

Accepted Solutions
sunny_talwar

Try this

='Female: '&count( {$<Gender *= {'Female'}>} ID)

='Male: '&count( {$<Gender *= {'Male'}>} ID)

View solution in original post

9 Replies
YoussefBelloum
Champion
Champion

Hi,

what are you trying to do ?

when you choose Female, you want the text box "Male" shows 0 ?

sunny_talwar

Try this

='Female: '&count( {$<Gender *= {'Female'}>} ID)

='Male: '&count( {$<Gender *= {'Male'}>} ID)

vishsaggi
Champion III
Champion III

May be try these

='Female: '&count( {< Gender = {"=GetFieldSelections(Gender) = 'Female' "} >} ID)

='Male: '&count( {< Gender = {"=GetFieldSelections(Gender) = 'Male' "} >} ID)

effinty2112
Master
Master

Hi Vytautas,

The set expression {$<Gender={'Male'}>} tells the aggregation function it is used in to disregard user selections for Gender and instead return the result as if 'Male' had been selected. The whole idea of set analysis is to allow expressions be be calculated over records that are not restricted solely to user selections in the document. For your purposes try Sum(DISTINCT if(Gender = 'Male',ID)).

Regards

Andrew

mohammadkhatimi
Partner - Specialist
Partner - Specialist

='Female: '&if(GetFieldSelections(Gender)='Female', count( {$<Gender={'Female'}>} ID),0)

='Male: '&if(GetFieldSelections(Gender)='Male', count( {$<Gender={'Male'}>} ID),0)

Try this..

Regards,

Mohammad

YoussefBelloum
Champion
Champion

Hi Sunny,

first time i see this.. can you explain the meaning of the STAR here ?

Thanks

YB

YoussefBelloum
Champion
Champion

Very nice post, thank you !

summerrain
Contributor III
Contributor III
Author

As always, amazing, Thanks!