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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

TopN based on % or dynamic measure?

Is this possible? I need the top10% of a value not a set whole number. I tried to create a measure and use that in the TopN dax formula but am receiving an error

 

jdaily83_0-1678722706210.png

 

I also tried this formula

jdaily83_1-1678722894809.png

 

 

1 REPLY 1
BrianConnelly
Resolver III
Resolver III

You didn't provide what [10% Distinct Owners] is, but I assume you have a slicer to show TOP number to show and a table with Opportunity Owners.  If so, try the following...

Net Sales Ranked:=
IF (
    ISINSCOPE ( 'RevRec'[Opportunity_Owner_Name] ),
    VAR OwnersToRank = [TopN]  -- Can Use Selected Value or hardcode, e.g 10
    VAR SalesAmount = [Sales Amount] -- OR SUM('RevRec'[Net Revenue])
    RETURN
        IF (
            SalesAmount > 0,
            VAR VisibleOwner =
                CALCULATETABLE (
                    VALUES ( 'RevRec' ),
                    ALLSELECTED ( 'RevRec'[Oportunity_Owner_Name] )
                )
            VAR Ranking =
                RANKX (
                    VisibleOwner,
                    [Sales Amount],
                    SalesAmount
                )
            RETURN
                IF (
                    Ranking > 0 && Ranking <= OwnersToRank ,
                    Ranking
                )
        )
)

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 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.