Forum Discussion
Tito
2 years agoHelper IV
MAX-Formula
Hello, I have a problem with the MAX formula. In my example, I want to calculate a sum of sales with maximum of date only for group A. And for group B I calculate the sum of sales without the maximu...
- 2 years ago
Hello,
I have solved the problem with the following DAX function.
Thank you very much for your support.ā
Dangar332
2 years agoResident Rockstar
hi, Tito
try below
sum sales current 2 =
var a = CALCULATE(MAX(tebelle1[date]),ALLEXCEPT(tebelle1,tebelle1[group]))
var b = SUMX(FILTER(tebelle1,tebelle1[date]=a),tebelle1[sales])
var c = SUMX(FILTER(tebelle1,tebelle1[group]="b"),tebelle1[sales])
return
b+c- Tito2 years agoHelper IV
Thank you for your answer.
I have tried the formula, but the calculation is not correct.- Dangar3322 years agoResident Rockstar
hi, Tito
try below code
sum sales current 2 = var a = CALCULATE( MAX(tebelle1[sales]), ALLEXCEPT(tebelle1,tebelle1[date]), KEEPFILTERS(tebelle1[group]="a") ) var b = CALCULATE( sum(tebelle1[sales]), tebelle1[sales]=a ) var c = CALCULATE( sum(tebelle1[sales]), KEEPFILTERS(tebelle1[group]="b") ) return b+c- Tito2 years agoHelper IV
Thank you for your help.
But when I add the date to the matrix, it doesn't show correctly.
ā