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

To display Top 10 + Others for Matrix with multiple filters as slicers

Hi Everyone,

Kindly suggest how can we implement 10 + others for matrix which shows calculations for Sales numbers in Matrix
1) Measure 1 - Sales Actual
2) Measure 2 - Sales Previous Year
3) Measure 3 -  Sales Budget

I need to implement Top 10 + Others for above measures in matrix which are sliced by Filters like Country, Account Owner, Client etc 

Thanks,
Radhika

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can refer the content in the following links to get it:

Filtering the top products alongside the other products in Power BI

Dynamic TopN + Others in Power BI

How To Use Top N + Others Functionality In Power BI

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
NidhiBhusari
Helper IV
Helper IV

Hi @Anonymous , can you share your sample dataset...i have implemented the TOP N + others using my dataset but unable to share the.pbix file here.

Hi @Anonymous , below are the steps i have implemented you can refer to these steps and let me know if it is beneficial for you.
1) 
Movie Name = UNION (VALUES ('Onyx Data - DataDNA Dataset Cha'[Movie Title]), ROW( "MovieName", "Others" ))

2) Here I have implemented Top N using profit calc on the basis of Movie Title.
 
Profit calc = CALCULATE(SUM('Onyx Data - DataDNA Dataset Cha'[Profit]), GROUPBY('Onyx Data - DataDNA Dataset Cha','Onyx Data - DataDNA Dataset Cha'[Genre]))

In your case, you need to calculate below three measures separately.

1) Measure 1 - Sales Actual
2) Measure 2 - Sales Previous Year
3) Measure 3 -  Sales Budget

3)Measure to calculate Top N values:-

Top X =
 
    VAR TopNumber =if(HASONEVALUE('TOP N'[Column1]),VALUES('TOP N'[Column1]),10)
VAR Rest =
COUNTROWS ('Onyx Data - DataDNA Dataset Cha') - TopNumber
RETURN
IF (
HASONEVALUE ( MovieName[Movie Title]),
CALCULATE (
[Profit calc],
FILTER (
'Onyx Data - DataDNA Dataset Cha',
[Movie Title] = VALUES ( MovieName[Movie Title])
&& CONTAINS (
TOPN (
TopNumber,
ADDCOLUMNS (
ALL (MovieName[Movie Title]),
"Profit", CALCULATE (
[Profit calc],
FILTER ( 'Onyx Data - DataDNA Dataset Cha','Onyx Data - DataDNA Dataset Cha'[Movie Title] = EARLIER ([Movie Title]))
)
),
[Profit], DESC
),
MovieName[Movie Title], VALUES ( MovieName[Movie Title])
)
)
)
)

Measure to calculate remaining values:-

Other =
 
    VAR TopNumber = if(HASONEVALUE('TOP N'[Column1]),VALUES('TOP N'[Column1]),10)
VAR Left =
COUNTROWS ( 'Onyx Data - DataDNA Dataset Cha' ) - TopNumber
RETURN
IF (
HASONEVALUE (MovieName[Movie Title]),
IF (
VALUES ( MovieName[Movie Title]) = "Others",
SUMX (
TOPN (
Left,
ADDCOLUMNS (
VALUES ('Onyx Data - DataDNA Dataset Cha'[Movie Title]),
"Measure", [Profit calc]
),
[Measure], ASC
),
[Measure]
)
)
)

5) At last create a table(here i have used the Name Slicer Table) and add names of measures between which you want to dynamically switch to get values.

SWITCH(TRUE(),
SELECTEDVALUE(Slicer[Measure Name]) = "Sales Actual",[Sales Actual],
SELECTEDVALUE(Slicer[Measure Namae])="Sales Previous Year",[Sales Previous Year],
SELECTEDVALUE(Slicer[Measure Namae])="Sales Budget",[Sales Budget],
BLANK())

NidhiBhusari_0-1627285770576.pngNidhiBhusari_1-1627285786890.png

 




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.