Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Syndicate_Admin
Administrator
Administrator

WEIGHTED AVERAGE IN THE TOTAL

Good morning!

I have a problem getting the weighted average in the total. Example:

We have 2 marketing campaigns, one that impacts men and the other women. For each campaign we have an action group (GA) and a control group (GC) to measure the impact of the campaign.

For each campaign we calculate the average sale of the GA and the average sale of the GC to obtain the GAP (difference between GA and GC):

robert_sola_2-1665135355642.png

The fact is that the total value of the GAP column (804.62) is not correct, since it is obtained by making the difference of the total means (1,120 - 315.38 = 804.62) and that value is not weighted by the weight of the field CLIENTES_GA.

In the total GAP I would like to obtain the gap weighted by campaign based on the number of CLIENTES_GA, that is, the multiplication of (1,340*100 + 441.67*150) / 250 = 801. As the GA and the GC have different weights in each campaign it is not correct to calculate the GAP as the difference in totals, it must be weighted.

In short, calculating the GAP per row would be fine, but when adding the two campaigns, the total would have to calculate the weighting based on the number of customers in each campaign.

Any idea how I can get that weighted Gap?

Thanks a lot!!!

Best regards

Robert

1 ACCEPTED SOLUTION
HoangHugo
Solution Specialist
Solution Specialist

Hi, try this one

 

GAP 2 =
var campaign =SELECTED([campaign column])

var client = SUM([client])
return if (campaign = BLANK(),GAP measure, SUMX(SUMMARIZE([campaign column]),GAP x client)/client)

View solution in original post

1 REPLY 1
HoangHugo
Solution Specialist
Solution Specialist

Hi, try this one

 

GAP 2 =
var campaign =SELECTED([campaign column])

var client = SUM([client])
return if (campaign = BLANK(),GAP measure, SUMX(SUMMARIZE([campaign column]),GAP x client)/client)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.