Forum Discussion

BalaR's avatar
BalaR
Data Storage
08-28-2025

Count (Boolean)

I have segmented the sample and i have 5 distinct segments. We have recoded the segments with a (boolean) Yes or No. So the data is setup as Segment A = Yes/ no. I want to use the 123 indicator to display the count of the segment and the secondary value as % of total sample. I have tried the 3 formulas below and none of them are giving me the count 
1. COUNT(
  FILTER(SEGMENT_A], [SEGMENT_A] = "Yes")
)

2. COUNTDISTINCT(
  FILTER([participant_id], [segment_A] = "Yes")
)

3. COUNT( FILTER([Segment_A], [Segment_A] = "Yes") )
/
NULLIF(
  COUNT( FILTER([Segment_A], [Segment_A] IN ("Yes","No")) ),
  0
)

Can you please advise what is the right way to calculate the count for Segment A? 

3 Replies

  • Hello BalaR​,

    Thank you for reaching out. I see your question hasn't gotten a response yet, so I'm asking internally to try and get you an answer. 

  • akaplan's avatar
    akaplan
    Sisense Employee

    Hi BalaR​,

    You're on the right track.  Similar to your attempts, I would use a formula filter on Segment_A to accomplish this.  You'll see these referred to as Measured Values in Sisense documentation.  I created a sample file containing 500 participant ids and randomized Yes/No segment values, structured like this:

    I was able to build an indicator showing total count (and contribution %) of the records with Segment_A = "Yes" by using the following formula:

    (count([Participant Id]), [Segment_A]) / count([Participant Id])

    The numerator pulls the total count of participant_id, with a filter on Segment_A = "Yes".  You right-click the filter field (Segment_A) and select "Filter" to assign the filter member(s).

    The denominator pulls the total count of participant_id, without any additional filters.

    Let me know if this solves your issue, or if any clarification is needed (or if I've misunderstood the requirement!).

     

  • Hello BalaR​,

    I’m following up to see if the solution offered by akaplan​ worked for you.

    If so, please click the 'Accept as Solution' button on their post. That way others with the same questions can find the answer. If not, please let us know so that we can continue to help.

    Thank you.