Calculate sum of maximum value of each country

chriscorpion786

Board Regular
Joined
Apr 3, 2011
Messages
112
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I'm trying to calculate the maximum value of each country and then sum the totals.
Can anyone help how to write a measure in Power BI for this. I can do this in Excel with an array formula, but cannot get it in Power BI.
Please see image below: I need to derive the totals which is 1296 of each maximum value for each country. Lets say this table is named Data in BI.

CountryDateValueCountryValue
AfghanistanWednesday, January 22, 2020
1​
Afghanistan
387​
AfghanistanThursday, January 23, 2020
21​
Bahrain
234​
AfghanistanThursday, May 21, 2020
45​
Pakistan
675​
AfghanistanFriday, May 22, 2020
110​
Total
1296
AfghanistanFriday, October 2, 2020
234​
AfghanistanSaturday, October 3, 2020
254​
AfghanistanSunday, October 4, 2020
387​
BahrainWednesday, January 22, 2020
0​
BahrainThursday, January 23, 2020
2​
BahrainThursday, May 21, 2020
4​
BahrainFriday, May 22, 2020
15​
BahrainFriday, October 2, 2020
45​
BahrainSaturday, October 3, 2020
119​
BahrainSunday, October 4, 2020
234​
PakistanWednesday, January 22, 2020
112​
PakistanThursday, January 23, 2020
250​
PakistanThursday, May 21, 2020
299​
PakistanFriday, May 22, 2020
324​
PakistanFriday, October 2, 2020
435​
PakistanSaturday, October 3, 2020
555​
PakistanSunday, October 4, 2020
675​

Much appreciated.
Mustafa
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
without PBI
with PQ group by Country with max by Value then standard Pivot Table just for Total
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table11"]}[Content],
    Group = Table.Group(Source, {"Country"}, {{"Max", each List.Max([Value]), type number}})
in
    Group
then
CountryMaxValue
Afghanistan387
Bahrain234
Pakistan675
Grand Total1296
 
Upvote 0
Please try

=sumx(SUMMARIZE(Data,Data[Country],"Max",Max(Data[Value])),[Max])
 
Upvote 0
Solution

Forum statistics

Threads
1,223,744
Messages
6,174,254
Members
452,553
Latest member
red83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top