Forum Discussion
ragygad
3 years agoFrequent Visitor
Compare values with if statement
I have a table with multiple fields and my main concern is 2 fields, one has ID and the other has grade (numerical field). I am trying to check first id ID to ID match in the same field and if they...
ragygad
3 years agoFrequent Visitor
is there a way to do it in DAX
- AbhinavJoshi3 years agoResponsive Resident
To achieve it in DAX, try this code NewColumn =
IF(
Table1[ID] = EARLIER(Table1[ID]),
IF(
Table1[Grade] > EARLIER(Table1[Grade]),
1,
0
),
BLANK()
)- ragygad3 years agoFrequent Visitor
I tried that but you cant have earlier in a function with if statement , it only works with filter function
- AbhinavJoshi3 years agoResponsive Resident
Oh I see, can you try this
NewColumn =
IF(
Table1[ID] = CALCULATE(MAX(Table1[ID]), FILTER(ALL(Table1), EARLIER(Table1[ID]) = Table1[ID])),
IF(
Table1[Grade] > CALCULATE(MAX(Table1[Grade]), FILTER(ALL(Table1), EARLIER(Table1[ID]) = Table1[ID])),
1,
0
),
BLANK()
)