cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Measure for Minimum n/sample size

Hi @chvrch ,

 

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
Highlighted
Community Support
Community Support

Re: Measure for Minimum n/sample size

Hi @chvrch ,

 

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

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors