Forum Discussion

jbittinger's avatar
jbittinger
Regular Visitor
9 years ago
Solved

Exclude cells with small sample sizes

New to Power BI and trying to get my bearings. I'm working with survey (Likert-type) data in a university setting, and as a result, we are concerned about protecting the confidentiality of respondents. In the data in question, there are numerous demographic measures (e.g., race, gender, sexual orientation) that we would like to be able to include. However, as multiple identities are introduced (e.g., Asian, Transgender. and Pansexual) the sample size in many cells falls below low a threshold we are comfortable display (n > 5).

 

Coming from Tableau, I know you could write some code to calculate when that would happen and hide cells that contained small sample sizes. Is this possible to do in Power BI? I much prefer the experience with Power BI, but this is a big issue that I need to resolve before trying to convince my office to move over.

 

Thanks for any help/insight!

  • Vvelarde's avatar
    Vvelarde
    9 years ago

    jbittinger

     

    Hi, Select the other chart and Go to Edit Interactions (Format Menu) and Select Filter instead of Highlight.

     

    Edit Interactions to Filter

10 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi jbittinger, we encountered this same problem as we have sensitive healthcare data. We were able to successfully suppress small numbers through the use of DAX formulas. Conceptually, the formula goes like this: "If the number to be displayed is less than n, then display '***', otherwise, display the number." An actual example is here: 

     

    @JobsNoFilters = if( CALCULATE(COUNT(AppendAllPrograms[Job Number]))<=50,"***",CALCULATE(COUNT(AppendAllPrograms[Job Number]),ALL(AppendAllPrograms[Job Number])))
     
    Cheers
    • jpb175's avatar
      jpb175
      Frequent Visitor

      This was the fix to our issue.  Thanks!!
      I simplified the DAX formula you provided and got the output we expected:

      FixedField1 = if(CALCULATE(SUM(Table1[Field1]))<=5, "***", CALCULATE(SUM(Table1[Field1])))
  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    You could create a simple COUNT measure and then add that to your report filter and set it to be >=5. If I understand the problem correctly.

    • jbittinger's avatar
      jbittinger
      Regular Visitor

      I think a picture will help here (and perhaps a COUNT measure is appropriate). In the picture below, I have selected women who have a low sense of belonging on the bottom right graph, which then highlights those women across the other graphs. I really like this feature, but some of the sample sizes are too small to display. For example, the cell I have circled has fewer than 5 respondents and I would want to hide that from being displayed.

       

      I began playing around with creating a COUNT measure and was not getting far with it. For the image below, there are 4 variables being used: Diverse, Belonging, Gender, and Race. Would I essentially have to build a long if/then logic calculation to use the COUNT measure?

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        I believe I duplicated this. I created the following data:

         

        EthnicityCategory

        Asian1
        Asian1
        Asian1
        Asian1
        Asian1
        Asian2
        Asian2
        Asian2
        Asian2
        Asian2
        Asian3
        Asian3
        Asian3
        Asian3
        Asian3
        Asian4
        Asian4
        Asian5
        Asian5
        Asian5
        Asian5
        Asian5
        Black1
        Black1
        Black1
        Black1
        Black1
        Black2
        Black2
        Black3
        Black3
        Black3
        Black3
        Black3
        Black4
        Black4
        Black4
        Black4
        Black4
        Black5
        Black5
        Black5
        Black5
        Black5

         

        I then put Ethnicity in my Axis, Category in my Label and then Count of Category (just changed the default summation from SUM to COUNT) in my Value. Then, in my filter area for the visual, I set "Count of Category" to "greater than or equal to 5"