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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
oakfootballclub
Helper IV
Helper IV

top n works well when there is only one dimension in matrix, but not work when multiple dimensions

Hi experts, I want to create a dynamic top n function in matrix visual,

here is the rankx DAX: 

cal_amount_FYTD_rk =
RANKX(
    ALLSELECTED(dim_pub_dict_staff_df[gpn])
    ,[cal_amount_FYTD_PreviousM],
    ,DESC,Dense
and here is the slicer I applied to the matrix visual:
_cal_slicer_FYTD_Amount_topx =
IF([cal_amount_FYTD_rk] <= SELECTEDVALUE(dim_topxslicer[col]),1,0)
 

it works well when only one dimension in row of matrix:

oakfootballclub_0-1717560017578.png

 

but when I dragged multiple dimensions, it fails to show and seems to loading data all the time,

oakfootballclub_1-1717560036342.png

 

any solutions?



4 REPLIES 4
oakfootballclub
Helper IV
Helper IV

the rank only based gpn level, when other dimension added, just keep the same rank

rajendraongole1
Super User
Super User

Hi @oakfootballclub - When dealing with multiple dimensions, make sure the RANKX function and filters are efficient.

 

cal_amount_FYTD_rk =
RANKX(
ALLSELECTED(
REMOVEFILTERS(
dim_pub_dict_staff_df[gpn],
dim_pub_dict_staff_df[another_dimension] -- Add other dimensions as needed
)
),
[cal_amount_FYTD_PreviousM],
,
DESC,
DENSE
)

 

Ensure the slicer measure respects the ranking for the selected dimensions

 

_cal_slicer_FYTD_Amount_topx =
IF(
[cal_amount_FYTD_rk] <= SELECTEDVALUE(dim_topxslicer[col]),
1,
0
)

 

Select a Top N Value from the slicer and Matrix Visual updates dynamically to reflect the top N items based on the selected value and all specified dimensions.

 

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thank you, I added a display name want to have a try, but it show an error, could you please look at where it goes wrong?

oakfootballclub_0-1717566984963.png

 

could anyone who is still intereted in this question help to solve it?

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.