Forum Discussion
jjohnson1990
6 years agoFrequent Visitor
Sum for filtered in distinct value
HELLO ALL, I currently have a table with below for columns. Sec SECTORDATE DEP DLY MIN PAX DEP DELAY CODE 5 1/1/20 0:00 20 167 15 - PH 8 1/1/20 0:00 85 167 91 - RL 10 1/1...
- 6 years ago
Hello az38 , thanks for the revert. i had run your code, it give me a constant value regardless of date
On modifying the code slightly i.e. removing the filter expression ALL(Query), this gave me the correct output as expected
Total PAX = CALCULATE(SUMX(SUMMARIZE('Query1','Query1'[Sec], "Total PAX", MAX(Query1[PAX])), [Total PAX]))
jjohnson1990
6 years agoFrequent Visitor
Hello az38 ,
you would see wihtin the table that the row for sectorkey [Sec] is duplicated for sectorkey= 16 and 23, where PAX value is also duplicated.
for sum(pax) , i want to take only of the duplicate values, that is distinct(sectorkey). i believe allexcept would totoally remove that sectorykey values, but i need to take only one (or distinct ) of it.
az38
Community Champion
6 years agoif I understand your needs correct, try a measure
Total PAX =
CALCULATE(SUMX(SUMMARIZE('Query1','Query1'[Sec], "Total PAX", MAX(Query1[PAX])), [Total PAX]), ALL(Query1))