March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Have setup a top n filter as per the link above. Wondering what has to be changed within the dax to make this work when another column is added to the matrix?
I can see that the rankx portion gets split over the new column for the sumx amounts when all we want is the rankings to be only over the matrix totals for Customer within the filtered context; Date, Company, etc. ie if Document Type Name is not part of the matrix.
Matrix visual setup...
Matrix display with rankx portion added as column...
Solved! Go to Solution.
Work around I figured out as follows. I created a rankx column using the rankx portion. Then add the rankx column as a Value to the matrix. Then squish the resulting columns to hide the new rankx column. Also code change to include isinscope for the AmountTopN measure. And set AmountSumx to zero for blanks. And exclude zero values from matrix via Filter to exclude zero value rows. And lastly turn off Word wrap for Column Headers to reduce the spacing bloat.
AmountSumx = SUMX('G_L Entry', [Amount])+0 // need to also set in Filters to ignore zero values
rankx =
RANKX (
ALLSELECTED( 'Customer'[Customer Name] ) // table
,[AmountSumx] // expression
, // value
,0 // order desc
,Dense // ties
)
AmountTopN =
VAR SelectedTop = SELECTEDVALUE('TopN'[TopN])
RETURN
SWITCH(TRUE(),
SelectedTop = 0, [AmountSumx],
IF(HASONEVALUE('Customer'[Customer Name]) // hide rankx column from matrix
,SelectedTop >=
RANKX (
ALLSELECTED( 'Customer'[Customer Name] ) // table
,[AmountSumx] // expression
, // value
,0 // order desc
,Dense // ties
)
,0)
, [AmountSumx]
)
Work around I figured out as follows. I created a rankx column using the rankx portion. Then add the rankx column as a Value to the matrix. Then squish the resulting columns to hide the new rankx column. Also code change to include isinscope for the AmountTopN measure. And set AmountSumx to zero for blanks. And exclude zero values from matrix via Filter to exclude zero value rows. And lastly turn off Word wrap for Column Headers to reduce the spacing bloat.
AmountSumx = SUMX('G_L Entry', [Amount])+0 // need to also set in Filters to ignore zero values
rankx =
RANKX (
ALLSELECTED( 'Customer'[Customer Name] ) // table
,[AmountSumx] // expression
, // value
,0 // order desc
,Dense // ties
)
AmountTopN =
VAR SelectedTop = SELECTEDVALUE('TopN'[TopN])
RETURN
SWITCH(TRUE(),
SelectedTop = 0, [AmountSumx],
IF(HASONEVALUE('Customer'[Customer Name]) // hide rankx column from matrix
,SelectedTop >=
RANKX (
ALLSELECTED( 'Customer'[Customer Name] ) // table
,[AmountSumx] // expression
, // value
,0 // order desc
,Dense // ties
)
,0)
, [AmountSumx]
)
Hi,
This solution didn't work. It could be great if you shared the pbix for our review.
Can you share PBix please, wanna look this solution.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
85 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |