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! Request now

Reply
RobX
Advocate I
Advocate I

Multiply with Multiple Where Clause

My model contains 3 tables that are related to each other.  Relationship is "Table Cost to Table Lead on Source" and "Table Lead to Table Sale on Lead".

 

I need to be able to create a measure that multiplies the count of sales by source against the cost of each source where the date of the cost is the same as the date of the sale.

 

I tried CALCULATE(COUNT(Sale[Lead] * Sum(Cost[Cost]), Sale[SaleDate] = Cost[Date]) but that doesn't work.

 

RobX_1-1601061495540.png

 

End result would be this.

RobX_2-1601061576679.png

 

 

2 REPLIES 2
MattAllington
Community Champion
Community Champion

How much data will you have?  Frankly I think everything would be easier if you simply merge the data in Power Query prior to load. You can merge the cost and lead table with 2 joins (date and source) and then extract the relevant cost into the lead table. I would then merge the sale date into the lead table too. Then the DAX is easy



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Matt,

 

I was hoping to avoid merging the tables.

 

Prey costs would coincide with the sale date so I'd have to bring the source column into the sales table and then merge that way, which isn't ideal since I lost the ability to project costs out to the leads.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.