Forum Discussion
msciarrino
Helper I
2 years agoRemove duplicates from a SUMX function using columns from multiple tables in DAX
Hello All, I am trying to create a measure were I get the sum of all the prices in one table and multiple it by the quantity of another table. I cannot combine the tables because the data set is ...
- Anonymous2 years ago
Hi msciarrino ,
Please try to create measure with below dax formula:
Measure = VAR cur_id = SELECTEDVALUE ( Table1[ID Numbers] ) VAR _a = CALCULATE ( MAX ( Table1[Quantity] ), FILTER ( ALL ( Table1 ), [ID Numbers] = cur_id ) ) VAR _b = CALCULATE ( MAX ( 'Table 2'[Price] ), FILTER ( ALL ( 'Table 2' ), [ID Numbers] = cur_id ) ) VAR _r1 = _a * _b VAR tmp = SUMMARIZE ( ALL ( Table1 ), Table1[ID Numbers], "QTY", MAX ( Table1[Quantity] ) ) VAR _c = CALCULATE ( MAX ( Table1[Quantity] ), FILTER ( tmp, [ID Numbers] = cur_id ) ) RETURN _r1Measure 2 = SUMX(VALUES(Table1[ID Numbers]),[Measure])Add a table visual with fields and measure:
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
2 years agoNot applicable
.
msciarrino
Helper I
2 years agoThis will work, but I want to avoid creating another table due to the large amount of data I am using. I would like to do it as a measure (or calculated column) if possible.
- Anonymous2 years agoNot applicable
You aren't creating another table. You are merging queries into one.