Forum Discussion
Calculating values based on two tables
- 3 years ago
maybe you want a measure, instead of calculated column
NewMeasure=SUMX(Products,COUNTROWS(RELATEDTABLE(orders))*Products[Price])
Hi,
Thanks for answering. Tried this and unfortunately, I get this error:
"A single value for column 'Price' in table 'Products' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."
The problem is - when I was using aggregation for the 'Price' - e.g. Max('Price') - it was getting the highest 'Price' from the table and just multiplied it by all rows.
- wdx223_Daniel3 years agoCommunity Champion
maybe you want a measure, instead of calculated column
NewMeasure=SUMX(Products,COUNTROWS(RELATEDTABLE(orders))*Products[Price])
- smartpug3 years agoNew Member
Yes, this is exactly what I need, thanks! Is it possible to modify this DAX to filter RELATEDTABLE(orders) to include only orders.DeliveryType = "Pickup"?
- wdx223_Daniel3 years agoCommunity Champion
NewMeasure=SUMX(Products,COUNTROWS(FILTER(RELATEDTABLE(orders),orders[DeliveryType]="Pickup"))*Products[Price])