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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Measure for Minimum n/sample size

Hi all, I have a tricky issue: how best to suppress low sample sizes which can be inferred from the present of other data? For example, when a male N is 2, and the total of staff is 9, then even when the male count of 2 is suppressed (disincluded), if the female count of 7 is provided then the male count can be readily inferred. (And this is an even simpler example as it's a binary category (for us) as opposed to multiple categories for things such as race/ethnicity and management band.

 

In order to preserve personal identity markers, I want to suppress any count <5. Looking at these two forum posts (https://community.powerbi.com/t5/Desktop/Exclude-cells-with-small-sample-sizes/m-p/176805 & https://community.powerbi.com/t5/Desktop/applying-filters-with-minimum-sample-size/m-p/659289) I am using the following DAX, which works well when substitute in the value portion of the visualization:

 

Suppress_Low_Sample = IF(COUNTAX(WORKER_AVG_HC,WORKER_AVG_HC[EEID])<=4, "***", COUNTAX(WORKER_AVG_HC,WORKER_AVG_HC[EEID]))

 

 

Voila, I got from this Not_Suppressed_Sample_Size.png

 to this

 Suppressed_Sample_Size.png

 

Now, my next issue should be apparent. With just a little bit of mental math, one is able to determine the suppessed sample size of 3 is actually 3 -- by subtracting 5 from 8. I've been toying around with various DAX but haven't landed on a workable solution.

 

I found a potential visual filter solution (https://community.powerbi.com/t5/Desktop/applying-filters-with-minimum-sample-size/m-p/659289), but it's not quite working for me:

 

MeasureforVisualFilter =
IF (
    CALCULATE ( COUNTROWS ( tableName ), ALLEXCEPT ( tableName, TableName[City] ) ) < 5,
    1
)

 

 I'd appreciate any thoughts or ideas to make this work, both for binary instances and cases where there are multiple categories to take into account.

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Does that meet your requirement?

Measure = 
VAR a =
    MINX (
        ALL ( WORKER_AVG_HC[EEID] ),
        CALCULATE ( COUNTX ( WORKER_AVG_HC, WORKER_AVG_HC[EEID] ) )
    )
VAR b =
    COUNTX ( WORKER_AVG_HC, WORKER_AVG_HC[EEID] )
RETURN
    IF ( a = b, "***", b )

Capture.PNG

 

Pbix as attached. If it doesn't meet your requirement,  kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

1 REPLY 1
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Does that meet your requirement?

Measure = 
VAR a =
    MINX (
        ALL ( WORKER_AVG_HC[EEID] ),
        CALCULATE ( COUNTX ( WORKER_AVG_HC, WORKER_AVG_HC[EEID] ) )
    )
VAR b =
    COUNTX ( WORKER_AVG_HC, WORKER_AVG_HC[EEID] )
RETURN
    IF ( a = b, "***", b )

Capture.PNG

 

Pbix as attached. If it doesn't meet your requirement,  kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.