Forum Discussion
Matrix Row Subtotal for Text as the most frequent values, instead of "First"
I have read many posts that mention similar topics, but they don't necessarily cover what I'm looking for. Usually, for text values in the Matrix, we only have options to display them as 'First', 'Last', or 'Count'. However, in this case, I want the row subtotal to show the most frequent values. If there are ties, it should display the values with the highest number in the subsequent values. Is there anyway to fix this behavior?
Link to the pbix with sample data
- Anonymous2 years ago
Hi Renna ,
You can create a measure as below and replace the field [Project Manager] with this new measure.
MProjectManager = VAR MaxCount = MAXX ( VALUES ( 'Table'[Project Manager] ), CALCULATE ( COUNT ( 'Table'[Project Manager] ) ) ) VAR PMList = CONCATENATEX ( FILTER ( VALUES ( 'Table'[Project Manager] ), CALCULATE ( COUNT ( 'Table'[Project Manager] ) ) = MaxCount ), 'Table'[Project Manager], ", " ) VAR ProjectTypeTable = SUMMARIZE ( 'Table', 'Table'[Project Types], 'Table'[Project ID], 'Table'[Project Manager] ) VAR ModeValue = TOPN ( 1, ADDCOLUMNS ( ProjectTypeTable, "SRevenue", CALCULATE ( SUM ( 'Table'[Revenue] ), ALLEXCEPT ( 'Table', 'Table'[Project Manager], 'Table'[Project ID], 'Table'[Project Types] ) ) ), [SRevenue], DESC ) RETURN IF ( IFERROR ( SEARCH ( ",", PMList, 1, 0 ), 0 ) > 0, MAXX ( ModeValue, [Project Manager] ), PMList )Best Regards
pls try this
9 Replies
- AnonymousNot applicable
Hi Renna ,
You can create a measure as below and replace the field [Project Manager] with this new measure.
MProjectManager = VAR MaxCount = MAXX ( VALUES ( 'Table'[Project Manager] ), CALCULATE ( COUNT ( 'Table'[Project Manager] ) ) ) VAR PMList = CONCATENATEX ( FILTER ( VALUES ( 'Table'[Project Manager] ), CALCULATE ( COUNT ( 'Table'[Project Manager] ) ) = MaxCount ), 'Table'[Project Manager], ", " ) VAR ProjectTypeTable = SUMMARIZE ( 'Table', 'Table'[Project Types], 'Table'[Project ID], 'Table'[Project Manager] ) VAR ModeValue = TOPN ( 1, ADDCOLUMNS ( ProjectTypeTable, "SRevenue", CALCULATE ( SUM ( 'Table'[Revenue] ), ALLEXCEPT ( 'Table', 'Table'[Project Manager], 'Table'[Project ID], 'Table'[Project Types] ) ) ), [SRevenue], DESC ) RETURN IF ( IFERROR ( SEARCH ( ",", PMList, 1, 0 ), 0 ) > 0, MAXX ( ModeValue, [Project Manager] ), PMList )Best Regards
- RennaFrequent Visitor
It works perfectly. Thank you so much!
- Ahmedx
Super User
- Ritaf1983
Super User
Hi Renna
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...- Ashish_Mathur
Super User
Hi,
Where is the link???