how to get two max values

Hi experts

I am stuck with the problem .looks easy but i unable to solve it .

Using BoXi 3.1 webi Olap cubes.

here my data looks like this

country   city  sales revenue

aaa       xxx     100

aaa       yyy     200

aaa      zzz     300

bbb       ddd    100

bbb       sss    200

bbb       ppp     200

ccc      qqq    300

what i would like to see my table is like

country    sales revenue

aaa         500

bbb         400

ccc         300

i want the first max and second max  from country aaa and sum it up. In the same way for the country bbb here lies the problem if both the values are max then i would like to aggregate both the values and have to show it as 400 .

Much appreciated with inputs.

Thanks and regards