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

Display only the first N rows of a matrix visual

Hello!

 

I am looking for a way to show only a certain number of rows in a Matrix visual. Here is a simplification of my case:


I have a table containing products data, such as name, ID, type of store, country where it was sold, number of units sold, their price and number of units that suffered some sort of issue. In short, I have the columns:

- Product_ID

- Name

- Country

- Store_Type

- Units

- Price

- Issues

I cannot aggregate products in the SQL view only by their ID because I want to be able to filter the types of stores I wish to have in the analysis.

I use a measure with a simple function to calculate a "score" for the worst offender products in the table:

 

 

Score =
    CALCULATE(SQRT(SUM(Products[Price])), FILTER(Products, [Issues] > 0)
    * CALCULATE(SUM(Products[Issues]))

 

 

I have the products aggregated (sum of units, sum of issues, their name, score) displayed in a Matrix visual, ordered from greatest to lowest scores. The rows are Countrys with Product_IDs nested in them.
I would like to show only the top N scores per country in the matrix. I could not find a way to do so yet, though I'm suspecting I should use RANKX and/or EARLIER, but I have no idea how...

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , if want topn inside country , then you need have sub category Rank

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
or refer: https://www.sqlbi.com/articles/filtering-the-top-3-products-for-each-category-in-power-bi/

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.