Forum Discussion
Anonymous
6 years agoNot applicable
Issue with sumx
Hello all, I've tried to put this in many ways by my own, but i'm still struggling to solve this problem. Sorry by advance if it seems like a beginer question. I hope somebody knows the answer h...
- Anonymous6 years ago
Thanks lot for your help,
I found the solution it's :
Rouge2 =SUMX (DISTINCT('Lot 2'[Competence]),CALCULATE (VAR CC =SUMX('Lot 2','Lot 2'[XP]-'Lot 2'[Prérequis])VAR AA =IF ( CC <0,0,QUOTIENT(CC, 12) + 1)VAR BB =IF ( AA >= 5,5*SUMx ('Lot 2','Lot 2'[Weight]), AA * SUMX ( 'Lot 2','Lot 2'[Weight]) )RETURNBB,Codelot2[Couleur]= "R"))
AntrikshSharma
6 years agoCommunity Champion
Maybe try something like this:
Rouge2 =
SUMX (
VALUES ( 'Table2'[C1] ),
CALCULATE (
VAR AA =
QUOTIENT ( SUMX ( 'Table2', 'Table2'[Xp] - 'Table2'[prérequis] ), 12 ) + 1
VAR BB =
IF ( AA >= 5, 5, AA * SUMX ( 'Table2', 'Table2'[Weight] ) )
RETURN
BB,
Codetable2[Couleur] = "R"
)
)Anonymous
6 years agoNot applicable
Hi Antriksh Sharma,
Thank you for your reply and the tips for writting in dax.
Unfortunately it's not working because I need in BB var that the 1st condition equal to 5 must be multipied by Table2[Weight] also.
😕
However, here is some data sample
| Xp | Prérequis | Weight | Points(Rouge2) | Competencies | |
| Value 1 | 36 | 12 | 10 | (Q(36-12,12)+1)*10=30 | C1 |
| Value 1 | 72 | 12 | 5 | (Q(72-12,12)+1*5 = 25 | C2 |
| Value 1 | 6 | 12 | 10 | 0 | C3 |