group by and a max of that in power bi measure code example
Example 1: power bi grouped count
Measure =
VAR __tmpTable = SUMMARIZE(brands,brands[Country],"__Brands",DISTINCTCOUNT(brands[ Brand]))
RETURN MAXX(__tmpTable,[__Brands])
Example 2: group by in power bi
GROUPBY (<table>, [<groupBy_columnName1>], [<name>, <expression>]… )