Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello, I am trying to create a measure for the cost per unit for a delivery. I have a measure for delivery cost. So I am trying to create a measure for total units in a delivery then a measure to divide total units by total delivery cost. Here is my data structure:
Delivery | Shipment | Delivery Cost | Units | Total Units | Cost Per Unit |
A | 1 | $20 | 5 | ||
A | 2 | $20 | 3 | ||
A | 3 | $20 | 6 | ||
A | 4 | $20 | 2 | 16 | $1.25 |
B | 6 | $30 | 3 | ||
B | 7 | $30 | 8 | ||
B | 8 | $30 | 2 | ||
B | 9 | $30 | 1 | 14 | $2.14 |
I want to create measures to get the data in red: Total Units and Cost Per Unit. I have a measure that gets the Max Cost for each delivery since each row for a delivery has the same cost value.
Solved! Go to Solution.
clarification: the 2 columns on the right (Total Units and Cost Per Unit) in the table are not in my data model. I want to create measures for them.
Hi @TomSinAA
New table=
Summerize(table,table[delivery],table[cost],"total units",sum(table[units]),"cost per unit",divide(table[cost],sum(table[units])))
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.
or simply drag delivery, cost in table visual.
and create two measure and drag them into table visual
Total units=sum(table[unit])
cost per unit=divide(table[cost],sum(table[unit]),0)
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.
The measure: Total units=sum(table[unit])
displays the same value as the units for each row. It does not add add units in a delivery
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
82 | |
67 | |
61 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |