Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Weighted Average based on Slicer Selection

Hi PowerBI Community,

 

I am looking to create a card which shows the weighted average based on slicer selection (Market). Below is a sample of the data I am working with:

 

With this data I want do do a weighted average of the CPM metric based on the total number of impressions for that market and further by the segment for each campaign. For example, I want to be able to see the weighted average CPM for the Netherlands (if selected in the market slicer) based on the total number of impressions for Broad Segments in the campaigns for the Netherlands. And then another card that shows the weighted average CPM for the Netherlands based on the total number of impressions for Precision segments in the campaigns for the Netherlands. The campaign segments with a higher proportion of the total impressions should therefore give a higher weighting to the average CPM for that market.

 

I hope this makes sense.

 

Thanks in advance for the help!

 

Tommy

 

MarketCampaignSegmentImpressions (mn)CPM
NetherlandsABroad           6,533,100 €       4.67
NetherlandsAPrecision           5,922,000 €       4.31
NetherlandsBBroad           6,736,700 €       4.72
NetherlandsBPrecision           5,998,300 €       4.10
NetherlandsCBroad         15,096,500 €       3.66
NetherlandsCPrecision         15,116,400 €       2.61
USAABroad         67,522,000 €       1.84
USAAPrecision         59,547,000 €       2.08
USAAPrecision         71,832,000 €       1.73
South AfricaABroad         15,441,025 €       0.80
South AfricaAPrecision         12,355,230 €       1.00
South AfricaBBroad         12,255,327 €       1.21
South AfricaBPrecision         11,319,853 €       1.31
South AfricaCBroad                           -   
South AfricaCPrecision                           -   
South AfricaDPrecision           4,890,000 €       1.14
South AfricaDPrecision               412,000 €       1.49
NetherlandsDBroad         184,000.00 €       8.26
NetherlandsDPrecision     4,491,000.00 €       3.09
NetherlandsDPrecision     6,106,860.00 €       2.71
NetherlandsDPrecision     1,670,900.00 €       3.95
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous ,

    You can create below 3 measure to get the weighted average:

    Measure = SUM('Markets'[Impressions (mn)])*SUM('Markets'[CPM])
    Impression*CPM = sumx('Markets',[Measure])
    Weighted Average = [Impression*CPM] / SUMX ( 'Markets', 'Markets'[Impressions (mn)] )

    And I just update my sample file to create the above measures, you can download it from this link.

    Best Regards

    Rena

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    It seems you want to get the average of CPM based on different market and segment... Could you please check if the below screen shot is what you want? 

    If the above screen shot is not your expected result, please provide your expected result in form of table or screen shot and explain more detail. Thank you.

    Best Regards

    Rena

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Rena, Anonymous 

       

      Thanks for getting back to me on this!

      Yes that is the view that I want to have exactly. Does the formula weight the averages based on the impressions that each of the lines have so that the lines with higher impressions, the average is weighted higher towards them? I don't want a straight average as that does not take into account that campaigns with more impressions should impact that average greater, but from a quick calculation it doesnt look like a straight average which is good.

       

      Could you share the Dax formula that you used?

       

      Thanks,

      Tommy

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

        Actually, I just used the system's own average function without creating any DAX formula, you can get my sample file from this link. If it is not your expected result, please provide your expected result in form of screen shot or a table and describe more details about it. Thank you.

        Best Regards

        Rena