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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Drop 3 highest and 3 lowest values from static 12 month average

I'm sharing a pbix file (attached)...

 
https://drive.google.com/file/d/1zXK30zA517fa1yAjkvqs0iJbtScLskqt/view?usp=sharing

 

Hello! I have a data set containing number of uses of an item by month for 12 months. I need to be able to pick an item from the slicer and have the table show usage in each month column 1, the average of the 12 months in every row (not rolling) as column 2 (I've done this in a measure calculating the average for the selected item with an ALL function), and the average with the top 3 and bottom three values dropped in column 3. The last part is where I'm getting stuck. Here's my visual so far: 

 

jhmonson_4-1647028297435.png

So I'm looking for one more column that would drop the highest and lowest three values from usage and average the remaining 6 for whatever item I have selected, eventually looking something like this if I've picked item 100008:

 

jhmonson_5-1647028337415.png

 

Any ideas? Thanks!

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Mid AVG = 
VAR __m = ALLSELECTED( 'Usage Data'[Month] )
VAR __rank = [RANK]
RETURN
    IF(
        __rank > 3 && __rank <= COUNTROWS( __m ) - 3,
        AVERAGEX(
            FILTER(
                __m,
                VAR __r = [RANK]
                RETURN
                    __r > 3
                        && __r <= COUNTROWS( __m ) - 3
            ),
            [Total]
        )
    )

CNENFRNL_0-1647055966469.png

 

Excel worksheet formula is way powerful to solve such a simple question,

CNENFRNL_1-1647056022982.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

1 REPLY 1
CNENFRNL
Community Champion
Community Champion

Mid AVG = 
VAR __m = ALLSELECTED( 'Usage Data'[Month] )
VAR __rank = [RANK]
RETURN
    IF(
        __rank > 3 && __rank <= COUNTROWS( __m ) - 3,
        AVERAGEX(
            FILTER(
                __m,
                VAR __r = [RANK]
                RETURN
                    __r > 3
                        && __r <= COUNTROWS( __m ) - 3
            ),
            [Total]
        )
    )

CNENFRNL_0-1647055966469.png

 

Excel worksheet formula is way powerful to solve such a simple question,

CNENFRNL_1-1647056022982.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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