Forum Discussion
Anonymous
7 years agoNot applicable
Most common for category
Hi,
I need a New Column like this "Mostcommon type" based on each user
| User | type | Mostcommon type |
| User 1 | A | A |
| User 1 | A | A |
| User 1 | B | A |
| User 2 | A | B |
| User 2 | B | B |
| User 2 | B | B |
Thanks!
Anonymous
How about this calculated column
Calc Column = CONCATENATEX ( CALCULATETABLE ( TOPN ( 1, VALUES ( Table1[type] ), CALCULATE ( COUNT ( Table1[type] ) ), DESC ), ALLEXCEPT ( Table1, Table1[User] ) ), [type], "," )
5 Replies
- parry2k
Super User
Anonymous is the criteria of getting most common type is based on count of types for each user?
- AnonymousNot applicable
parry2k ,
exactly
- petrovnikitamai
Resolver V
try to add two columns:
1. Calculate count match types by user
MostPopularType = COUNTX( FILTER(TableName; EARLIER(TableName[User])=TableName[User] && EARLIER(TableName[type])=TableName[type]); TableName[type])2. Return most popular type
Mostcommon type(check) = var mmax = MAXX( FILTER(TableName; EARLIER(TableName[User])=TableName[User]); TableName[MostPopularType]) return LOOKUPVALUE(TableName[type];TableName[User];TableName[User];TableName[MostPopularType];mmax)i get:
mb someone knows the best way calculate it
- AnonymousNot applicable
Hi petrovnikitamai ,
Thank you,
First column works great, for second one i get error message:
My real dataset contains a lot more values...
- Zubair_Muhammad
Community Champion
Anonymous
How about this calculated column
Calc Column = CONCATENATEX ( CALCULATETABLE ( TOPN ( 1, VALUES ( Table1[type] ), CALCULATE ( COUNT ( Table1[type] ) ), DESC ), ALLEXCEPT ( Table1, Table1[User] ) ), [type], "," )