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

top 5 and others but with Details

hello..

I made an equation to find top 5 and others to be displayed in Piechart by

1- create a table

 

Product Ranking = 
UNION ( 
    SELECTCOLUMNS (
        ALLNOBLANKROW ( 'Product'[Product Name] ),
        "Ranking name", 'Product'[Product Name],
        "Ranking group", 'Product'[Product Name]
    ),
    { 
        ( "Others", "Others" )
    }
)

 

2- create a measure

 

TopN Sales = 
IF (
    ISINSCOPE ( 'Product Ranking'[Ranking group] ),  -- Show a value only if the Ranking Group is filtered
    VAR NumOfProducts = 4
    VAR RankingGroup =
        SELECTEDVALUE ( 'Product Ranking'[Ranking group] )
    VAR TopProducts =
        TOPN ( NumOfProducts, ALLSELECTED ( 'Product Ranking' ), [Sales Amount] )
    RETURN
        if(
            RankingGroup <> "Others", 
                CALCULATE ( [Sales Amount], KEEPFILTERS ( TopProducts ) ),
                    if(
            RankingGroup = "Others", 
                IF (
                    NOT ISINSCOPE ( 'Product Ranking'[Ranking name] ),
                    VAR TopAmount =
                        CALCULATE ( [Sales Amount], TopProducts )
                    VAR AllAmount =
                        CALCULATE ( [Sales Amount], ALLSELECTED ( 'Product Ranking' ) )
                    VAR OthersAmt = AllAmount - TopAmount
                    RETURN
                        OthersAmt
                ))
        ),
    [Sales Amount]
)

 

 
3- the result was 
radissoufan_0-1659982494676.png

 

the next request was about when hover or drill down on others  it gives him the detaild Products in others

any help!

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Create a measure that uses CONCATENATEX of the product names. Use that measure as the tooltip.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

Create a measure that uses CONCATENATEX of the product names. Use that measure as the tooltip.

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.