I have the following dataframe in PowerBI table:
mass (kg) number of boxes
10 2
blank 3
20 blank
blank blank
First row means that two boxes were delivered and were weight as 10 kilograms together. Second row means that 3 boxes were delivered, but that the weighing system was broken. Third row means that the delivery person forgot to record the number of boxes (but 20 kilograms in total were delivered). And fourth row means no delivery.
No I am interested in the total amount of kilograms for each row that got delivered, in which the cases in which the weighing system was broken, the average weight of one box is used to calculate total weight:
Total mass (kg)
10
15
20
0
I already created a measure calculating the average weight of 1 box as:
Average weight per box (kg) = AVERAGEX( 'Table 1', DIVIDE('Table 1'[mass (kg)],'Table 1'[number of boxes]))
However, I get stuck now in creating the Total mass (kg) column in DAX coding.. how to solve this issue?