powerbi groupby return group with max value code example
Example 1: mysql group by max value
-- MySql: First result only returned, so Person with max age in each Group
select *
from (select * from mytable order by `Group`, age desc, Person) x
group by `Group`;
Example 2: power bi sum group by
Total value by category =
VAR
category = [Category]
RETURN
CALCULATE(SUM([Value]), FILTER(Table1, [Category] = category))