Forum Discussion

rulloa's avatar
rulloa
Regular Visitor
9 years ago
Solved

sum and average

Hello everyone, the question is:

I have the following table.

CustomerSub CustomerMonthN°Amount
AAX1100000031
AAX295000028
AAX390250031
AAX485737530
AAX581450631
AAX677378130
AAX773509231
AAX869833731
AAX966342030
AAX1063024931
AAX11100003
AAY195000031
AAY290250028
AAY385737531
AAY481450630
AAY577378131
AAY673509230
AAY769833731
AAY866342031
AAY963024930
AAY1059873731
AAY115688008
BBX185000031
BBX280750028
BBX376712531
BBX472876930
BBX569233031
BBX665771430
BBX762482831
BBX859358731
BBX956390730
BBX1053571231
BBX1150892615
BBY170000031
BBY266500028
BBY363175031
BBY460016330
BBY557015431
BBY654164730
BBY751456431
BBY848883631
BBY946439430
BBY1044117531
BBY11 12

 

I need to calculate in Power BI the amount for each subcustomer which is the sum of the amount (easy) but when grouping by customer should be the average of the amount of the subcustomers in every customer. And before the customer i have more levels. And these leves must be calculated in the same way that the customers like this.

 

CustomerSub CustomerMonthTotal Amount
AAX 307
 AY 312
Total A avg309,5
BBX 319
 BY 316
Total B avg317,5
Total generalavg313,5

 

Could you help me to do it?

2 Replies