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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.