Forum Discussion
kala2
5 years agoHelper III
Distinct and Sum multiple columns
I want to distinct rows and the sum each row certain columns:
So i want to distinct the rows by Projekt ID and then sum the columns:
OFFEN - in Verzug
OFFEN - planmäßig
OFFEN - Start überfällig
IN ARBEIT - in Verzug
IN ARBEIT - planmäßig,
ABGESCHLOSSEN
I have this measure now for one column:
SumDistinctPT = SUMX(DISTINCT('Table'[Projekt ID]), FIRSTNONBLANK('Table'[ABGESCHLOSSEN], 0))
which returns 24 result correctly
Expected sum to return for all distincted rows is: 133 (Sum of all distincted rows of the specific columns)
which returns 24 result correctly
Expected sum to return for all distincted rows is: 133 (Sum of all distincted rows of the specific columns)
Any ideas how to distinct and sum multiple columns?
- Anonymous5 years ago
Hi kala2, how about something like the below.
SumDistinctAllColumns = VAR _DistinctTable = SUMMARIZECOLUMNS ( [OFFEN - in Verzug], [OFFEN - planmäßig], [OFFEN - Start überfällig], [IN ARBEIT - in Verzug], [IN ARBEIT - planmäßig], [ABGESCHLOSSEN] ) VAR _Result = SUMX ( _DistinctTable, [OFFEN - in Verzug] + [OFFEN - planmäßig] + [OFFEN - Start überfällig] + [IN ARBEIT - in Verzug] + [IN ARBEIT - planmäßig] + [ABGESCHLOSSEN] ) RETURN _Result
2 Replies
- AnonymousNot applicable
Hi kala2, how about something like the below.
SumDistinctAllColumns = VAR _DistinctTable = SUMMARIZECOLUMNS ( [OFFEN - in Verzug], [OFFEN - planmäßig], [OFFEN - Start überfällig], [IN ARBEIT - in Verzug], [IN ARBEIT - planmäßig], [ABGESCHLOSSEN] ) VAR _Result = SUMX ( _DistinctTable, [OFFEN - in Verzug] + [OFFEN - planmäßig] + [OFFEN - Start überfällig] + [IN ARBEIT - in Verzug] + [IN ARBEIT - planmäßig] + [ABGESCHLOSSEN] ) RETURN _Result- kala2Helper III
Thanks! working perfectly!