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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Exclude greatest 5% of values from the data set (Avg. number of days) using a button click.

Exclude greatest 5% of values from the data set (Avg. number of days) using a button click.
Example: 100 line items in the grid. Button is clicked to exclude the 5% greatest average no. of days(Cycle time) line items. I have created a DAX measure for this but not able to fix this. Below is my DAX expression. I have around 27,000 records in my dataset. It is not at all able to exclude top 5% of NSRs.

Top 5% =
VAR _Avg =
    AVERAGE('Global_NSR'[NSR Approval Cycle Time(Actual) ])
VAR _top =
    CALCULATE (
        COUNTROWS ( ADDCOLUMNS ( VALUES ( Table[nsrnum] ), "_Avg", _Avg ) ),
        REMOVEFILTERS ( Table[nsrnum] )
    ) * 0.05   
    RETURN
   CALCULATE (
        CALCULATE ( AVERAGE('Table'[NSR Approval Cycle Time(Actual) ]) ),
        KEEPFILTERS (
            TOPN (
                _top,
                ALLSELECTED ( Table[nsrnum] ),
                CALCULATE ( AVERAGE('Table'[NSR Approval Cycle Time(Actual) ]) ), DESC
            )))
Seeing the same result after adding the Top 1% result. Top 5% measure is not at all loading.
tanisha_10_0-1719250749483.png

 


TIA,
Tanisha
        
    
1 ACCEPTED SOLUTION
mh2587
Super User
Super User

1. Calculate the Threshold for the Top 5% Values
Create a measure to determine the value that separates the top 5% of NSR Approval Cycle Time (Actual):
Top_5_Percent_Threshold = 
VAR TotalCount = COUNTROWS('Global_NSR')
VAR Top5PercentCount = INT(TotalCount * 0.05)
RETURN
CALCULATE (
    MAXX (
        TOPN (
            Top5PercentCount,
            'Global_NSR',
            'Global_NSR'[NSR Approval Cycle Time(Actual)],
            DESC
        ),
        'Global_NSR'[NSR Approval Cycle Time(Actual)]
    )
)

2. Create a Calculated Table Excluding the Top 5% Values
Create a new calculated table that excludes the top 5% of values based on the calculated threshold:
Filtered_Global_NSR = 
VAR Threshold = [Top_5_Percent_Threshold]
RETURN
FILTER (
    'Global_NSR',
    'Global_NSR'[NSR Approval Cycle Time(Actual)] <= Threshold
)


By creating this calculated table, you can then use it in your reports and visualizations to work with the dataset excluding the top 5% of NSR Approval Cycle Time (Actual) values.

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



View solution in original post

1 REPLY 1
mh2587
Super User
Super User

1. Calculate the Threshold for the Top 5% Values
Create a measure to determine the value that separates the top 5% of NSR Approval Cycle Time (Actual):
Top_5_Percent_Threshold = 
VAR TotalCount = COUNTROWS('Global_NSR')
VAR Top5PercentCount = INT(TotalCount * 0.05)
RETURN
CALCULATE (
    MAXX (
        TOPN (
            Top5PercentCount,
            'Global_NSR',
            'Global_NSR'[NSR Approval Cycle Time(Actual)],
            DESC
        ),
        'Global_NSR'[NSR Approval Cycle Time(Actual)]
    )
)

2. Create a Calculated Table Excluding the Top 5% Values
Create a new calculated table that excludes the top 5% of values based on the calculated threshold:
Filtered_Global_NSR = 
VAR Threshold = [Top_5_Percent_Threshold]
RETURN
FILTER (
    'Global_NSR',
    'Global_NSR'[NSR Approval Cycle Time(Actual)] <= Threshold
)


By creating this calculated table, you can then use it in your reports and visualizations to work with the dataset excluding the top 5% of NSR Approval Cycle Time (Actual) values.

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors