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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ws690
Regular Visitor

create a measure of totals by filtering one column, using the content of another

Hi,

I'm new to PowerBI so apologies if this is an obvious thing to do 🙂

 

I have a problem where I want to get the average cost per conversion. So the Total cost of all Campaign ads where a conversion has occured divided by the total number of conversions.

 

So I essentially want to find out where any conversion exists, which campaigns they realte to, then total all of the ad spend from those campaigns, divided by the total number of conversions. So any campaign where there have been no conversions is not inlcuded in the total.

 

Campaign NameAd versionTotal SpentImpressionsClicksConversions
Campaign 117.7131351
Campaign 123.035510
Campaign 132.1839240
Campaign 212.665110
Campaign 221.4530230
Campaign 232.1839240
Campaign 311.82031
Campaign 321.391870
Campaign 331.0515340
Campaign 341.32120
Campaign 412.223350
Campaign 422.281640
Campaign 511.791880
Campaign 521.9533340
Campaign 531.1812120

 

Here's an example of the data table I'm working with.

 

Can anyone help?

 

Thanks in advance 

1 ACCEPTED SOLUTION

This will get the right result

Cost per conv =
var campaignsWithSpend = CALCULATETABLE( VALUES(Campaign[Campaign Name]), Campaign[Conversions] > 0)
var totalSpend = CALCULATE( SUM(Campaign[Total Spent]), campaignsWithSpend )
var totalConv = SUM(Campaign[Conversions])
return DIVIDE( totalSpend, totalConv)

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

Cost per conv =
var totalSpend = CALCULATE( SUM(Campaign[Total Spent]), Campaign[Conversions] > 0)
var totalConv = SUM(Campaign[Conversions])
return DIVIDE( totalSpend, totalConv)

Hi @johnt75 ,

Thanks for your response. This looks to be providing me with the cost for just the line items where the conversion occured.

I am actually looking to get - the total campaign spend, where there has been a conversion, rather than just that ad version.

So in the table below, the conversion on Campaign 1, should add upp all the totals for everything that is listed under Campaign 1, not just the top line.

Does that make sense?

 

Ads converted.png

Is that possible?

 

Thanks

This will get the right result

Cost per conv =
var campaignsWithSpend = CALCULATETABLE( VALUES(Campaign[Campaign Name]), Campaign[Conversions] > 0)
var totalSpend = CALCULATE( SUM(Campaign[Total Spent]), campaignsWithSpend )
var totalConv = SUM(Campaign[Conversions])
return DIVIDE( totalSpend, totalConv)

Thank you so much 🙂

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.