Forum Discussion
Anonymous
5 years agoNot applicable
Sort a matrix column dynamically based on totals
I have a matrix where I want to sort both on the rows and on the columns at the same time. This would thus lead to the highest amount both for rows and columns to be in the top left corner of a Matri...
v-kelly-msft
Community Support
5 years agoHi Anonymous ,
Create the following columns:
in Purchase table:
Total sum = SUMX(FILTER('Purchase','Purchase'[Product ID]=EARLIER(Purchase[Product ID])),'Purchase'[Amount])
In product table:
Value =
LOOKUPVALUE('Purchase'[Total sum],'Purchase'[Product ID],'Product'[Product ID],0)Rank = RANKX(GROUPBY('Product','Product'[Product Group]),SUMX(FILTER('Product','Product'[Product Group]=EARLIER('Product'[Product Group])),'Product'[Value]),,DESC,Dense)_Product Group = 'Product'[Product Group]
And select column "_Product Group">sort by Rank:
Then in the matrix,put columns "__Product Group" and "Rank" in the columns field:
Finally you will see:
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Syndicate_Admin
Administrator
4 years agoThis error appears when I want to sort according to the rank.