Forum Discussion

oakfootballclub's avatar
2 years ago

top n slicer problem in matrix

Hi experts, I created a topn slicer to get the topn dynamically, it works well when there is no value in column in matrix and works well in table, but when I expand the dimension in column in matrix, it fails to return the n rows i selected

so how to solve it?

the rank that I calculated:

RANKX(
    ALL(dim_staff[gpn])
    ,[cal_amount_PPEDD],
    ,DESC,Dense
)

works well when column not dragged:

 

fails to return selected n rows required:

 

 

here is the method which I created topn:
https://youtu.be/vm2mdEioQPQ

 

 

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi oakfootballclub ,

    The problem might be due to the filter context of the visual. When you expand the dimension in the matrix, the filter context changes, which might affect the ranking. Could you please provide some raw data in the table 'dim_staff'  (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following link to share the required info:

    How to provide sample data in the Power BI Forum

     

    And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

     

    In addition, you can refer the following links to get it.

    Filter Top N Values with a Slicer in Power BI 

    Solved: Top N Slicer in a matrix? - Microsoft Fabric Community

    Best Regards

    • oakfootballclub's avatar
      oakfootballclub
      Icon for Helper IV rankHelper IV

      Thank you, the data is quite straightforwad, I reviewed the raw data and it just exactly the same as the following shows:

      dim_staff     
       gpn bu sl
       67831 MKT MKT1
       30277 MKT MKT2
       45111 SALES SALES1
       47039 SALES SALES2
       58663 SALES SALES3
      dim_category     
       id category subcategory
       10 A A1
       20 A A2
       11 A A3
       10 A A4
       13 B B1
       14 B B2
      fact_table     
       category_id staff_gpn amount
       17 63651 446658
       10 47463 682308
       11 62831 390495
       13 46428 677903
       15 31168 487138
       11 54683 590078
      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi oakfootballclub ,

        Based on this sample data you've provided, what do you ultimately want to look like? Is it possible to create a PBIX file with the data you provide, which contains the sample data and the results you want? You can refer the following link to upload the pbix file in the community. Thank you~

        How to upload PBI in Community

        Best Regards