Forum Discussion
MahiK
3 years agoRegular Visitor
Unique sum using DAX
PCode PNAME VALUE VC CE ABC 100 XX CE ABC 100 XY MNO 200 YY XM PQR 100 ZZ I want total sum for VALUE column it should only sum values for unique PCode,PName and Value combination like it should ...
MahiK
3 years agoRegular Visitor
Thanks but The value column is coming from different table so in summarize we can not have all three columns which is causing the issue
MS_Sum
3 years agoFrequent Visitor
Assuming you are retrieving values based on PCode matching in both tables, if so merging (Left Outer Join) should work and can summarize with the values. If not let me know in what condition the "values" will be fetched.
Total Sum =
SUMX (
SUMMARIZE (
'PTable',
'PTable'[PCode],
'PTable'[PName],
'PTable'[QTable.Value],
"Count", CALCULATE (
COUNTROWS('PTable'),
'PTable'[PCode] = EARLIER('PTable'[PCode]),
'PTable'[PName] = EARLIER('PTable'[PName]),
'PTable'[QTable.Value] = EARLIER('PTable'[QTable.Value])
)
),
IF([Count] = 1, PTable[QTable.Value], 'PTable'[QTable.Value])
)
Let me know if that works with a kudo and marking the suggestion as a solution.