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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
deepalig
Frequent Visitor

TopN with other Share at brand level. Other values is not giving correct value.

Hi All,

I am trying to get top 10 brands with their share % and other should be give share % for rest of the brands.

I checked a few methods which helped me getting my top 10 share but other is giving 100 % which is not the right value.

DAX

1. I created a separate brand table with Other as new row as below.

TopBrands =
    UNION(
        VALUES('Table'[brand]),
        ROW("Brand","Other")
    )
          also created a column named Order using dax as 
          Order brands = if('Top Brands'[brand]="Other",2,1)

2. Created one to many relationship  between 'TopBrands' table and main table on brand
3. Created a rank measure         
Brand Ranking by share % =
 RANK(DENSE,ALL('Top Brands'),orderby('Top Brands'[Order brands],ASC,[Brand Share %],desc))

4.Brand Share % is calculated based on nested measure to give values based on different slicer selection,for example -YTD,MTD and on each selection the value should change
Brand Share % =
var Divisor = CALCULATE([NestedMeasure], ALLSELECTED('Top Brands'[brand]))
RETURN DIVIDE([NestedMeasure], Divisor, BLANK())

5. At last created 
Total with other =
if([Brand Ranking by share %] <= 10, [Brand Share %],
    if(HASONEVALUE('Top Brands'[brand]),
        if(values('Top Brands'[brand]) = "Other",
            sumX(filter(ALL('Top Brands'[brand]), [Brand Ranking by share %] > 10),  [Brand Share %])
        )
    )
This is giving me result as below screenshot where othe is coming up as 100% and is not correct.

deepalig_0-1716896631808.png

 

Can someone help me in this?


Thank you in advance!


1 ACCEPTED SOLUTION
deepalig
Frequent Visitor

Hi All, 

Its resolved. Solved by modifying Brand Share% measure. Used All in place of Allselected fulfilled my requirement. 

Thank you 

 

View solution in original post

2 REPLIES 2
deepalig
Frequent Visitor

Hi All, 

Its resolved. Solved by modifying Brand Share% measure. Used All in place of Allselected fulfilled my requirement. 

Thank you 

 

Hi, @deepalig 

Glad to hear you solved the problem yourself!  

Congratulations

 

Best Regards

Yongkang Hua

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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