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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
debosul
Frequent Visitor

Average purchases by campaign

I have two tables with one to many relationship:

Table1: Sales:

Sales IdCustomer Id
9001A
9002B
9003B
9004A
9005D
9006E


Table2: Sales details:

Sales IdCampaign Id
9001C1
9001C8
9002C3
9002C10
9002C11
9003C40
9004C1
9004C18
9005C3
9006C6
9006C6
9006C10


You should know that the column "Customer_Id" has blanks.

I want to calculate how many purchases a customer did by campaign. Any thoughts?
Thanks on advanced

1 ACCEPTED SOLUTION
Whitewater100
Solution Sage
Solution Sage

Hello: Here is the avg campaings/known customer. I hope this is what you are looking for.

 

Whitewater100_0-1647477481392.png

https://drive.google.com/file/d/1VtPEjBK70Msz5hQcBtKZU4X9bl-eSQcT/view?usp=sharing 

View solution in original post

4 REPLIES 4
Whitewater100
Solution Sage
Solution Sage

Hello: Here is the avg campaings/known customer. I hope this is what you are looking for.

 

Whitewater100_0-1647477481392.png

https://drive.google.com/file/d/1VtPEjBK70Msz5hQcBtKZU4X9bl-eSQcT/view?usp=sharing 

amitchandak
Super User
Super User

@debosul , a measure like

AverageX(values(sales[customer ID]), calculate(count('sales details'[Campaign Id]) ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for your reply.

This is exactly what I'm after but I face a problem. The column "Customer ID" has blanks. I tried to replace "VALUES" with "DISTINCT" and "ALLNOBLANKROW" but it didn't solve it. Do you have any suggestion about this?

@debosul , replace null id's in power query with some value, that would be better

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.