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
JNelson
Helper II
Helper II

Dividing rows/measures

Hello,

 

I have data pulling through from an online source of our accounting system. I am trying to divide each row's [Cost] by [Quantity Produced] to get a unit rate. I am having trouble getting it to calculate for each row, it's only producing the Total unit rate. I have a filter applying to the date of the data too. 

 

Example of the data:

[Quantity Produced] = 3,000

Material/Account CodeCostCurrent outcomeIdeal outcome (Cost / Qty)

Material A

$40,000infinity$13.33
Material B$60,000infinity$20.00
Material C$5,000infinity$1.67
Material D$2,000infinity$0.67
Total$107,000$35.67$35.67

 

Thanks in advance!

3 REPLIES 3
amitchandak
Super User
Super User

@JNelson , You should not use measure in calculated column you should create a measure

 

divide([Qty Meausre], Sum(Table[Cost])

 

 

Line level measure

Sumx(Table, Divide([Qty Measure], [Cost])

 

or

 

AverageX(Table, Divide([Qty Measure], [Cost])

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 @amitchandak .

 

So it is not possible to get the unit rates against each item? I've tried each dax you provided and they're not working. Could it be because the Cost and Quantity measures are in different tables?  The SUMX formula just yields blank entries in the table.

 

Thanks

@JNelson , Not if cost and QTY are from the different tables we should try to have a new column,

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

 

or use summarize of values in the measure

Assume there is a common table item

 

Divide(sumx(summarize('Item', "_1", calculate(Sum(Table1[Cost]) * Sum(Table2[Qty]) ) ),[_1]),Sum(Table2[Qty]) )

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.