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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.