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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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