Forum Discussion
P_Stavis
1 year agoRegular Visitor
DAX - Remove duplicates and sum the values
Hello! I'm trying to use DAX to remove the duplicates, based on a column and then sum the values of another column. Manually removing the duplicates in PQ returns the correct values however my D...
- 1 year ago
Heres the formula that did the job:
For price:
Sum_Price_Ok =SUMX(DISTINCT('Sample Data'[Product_ID]),CALCULATE(FIRSTNONBLANK('Sample Data'[Price], 0)))For the weight:Sum_Weight_Ok =SUMX(DISTINCT('Sample Data'[Product_ID]),CALCULATE(FIRSTNONBLANK('Sample Data'[Item_weight], 0)))
P_Stavis
1 year agoRegular Visitor
Heres the formula that did the job:
For price:
Sum_Price_Ok =
SUMX(
DISTINCT('Sample Data'[Product_ID]),
CALCULATE(
FIRSTNONBLANK('Sample Data'[Price], 0)
)
)
For the weight:
Sum_Weight_Ok =
SUMX(
DISTINCT('Sample Data'[Product_ID]),
CALCULATE(
FIRSTNONBLANK('Sample Data'[Item_weight], 0)
)
)