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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Dawn7047
Frequent Visitor

How to create an "Others" value with Top 3 products under each category with a filter on the page.

I first uploaded my query table named "Sheet1" as follows:

DUMMY_TABLE.PNG

I wanted to create a DAX expression which showed the Top 3 and Others values, so I first created a table named "PRODUCT NAMES" with all the product names along with an "Others" row:

 
PRODUCT NAMES = UNION(
                      VALUES(Sheet1[products]),
                      ROW("Product Names","Others")
)
The table was formed as follows with "Others" being denoted by the red circle:
new table.PNG
 
The Top 3 products were first denoted with the expression:
TopN = 3
 
The sum of the "Current Volume" is denoted using the formula:
Total Volume = CALCULATE(SUM(Sheet1[Current volume]))
 
A ranking was then denoted with "Others" at 4th place using the DAX expression:
 
RankbyVolume = IF(
                  SELECTEDVALUE('PRODUCT NAMES'[products])="Others",
                   [TopN]+1,
                   RANKX(
                       ALL('PRODUCT NAMES'),
                       [Total Volume])
)
The formula was used to rank products according to Total Volume" but to determine the value for "Others" I used a DAX expression to add up all values greater than the Top 3 as follows:
 
top product & others =
IF(
    [RankbyVolume]<=[TopN], [Total Volume],
    IF(SELECTEDVALUE('PRODUCT NAMES'[products])= "Others",
       SUMX(
           FILTER(
                ALL('PRODUCT NAMES'[products]),
                [RankbyVolume]>[TopN]),
             [Total Volume]
       )
    )
)
 
I then used a Pivot Table visual to display the Total Volume, RankbyVolume and top product & others values as shown below:
DUMMY_VISUAL.PNG
I then applied a filter where "top product & others"is greater than 0:
filter2.PNG
I also added category values from "Sheet1", which has 3 categories of products (alpha, beta & omega), in the row with the following results:
Capture.PNG
 The main problem is that I want a DAX expression which displays 4 rows (Top 3 products and Others ) for each category on "Sheet1" (alpha, beta & omega).
 
Does anyone have the solution to this problem?
2 REPLIES 2
v-yinliw-msft
Community Support
Community Support

Hi @Dawn7047 ,

 

Could you please tell me that you just want 4 rows in one catagory?

Top 3 and Others rows?

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Yes, I wanted to know how to display 4 rows (Top 3 products and Others) for each category (alpha, beta and omega) of products.

Apologies for not making it more clear in the question.

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors