Forum Discussion
Compare two rows with DAX
Hi guys ,
I would like to compare two rows value and return with 'false' or 'true' in another column. This is my example data:
Table A
row 1 column A column B
row 2 1000 Yes
row 3 1000 No
row 4 1002 Yes
row 5 1002 Yes
row 6 1002 No
row 7 1004 N/a
To get the results in column B, my formula in excel will be:
= IF(row2columnA=row3columnA;"Yes";"No")
How can I apply the above formula in DAX?
Many thanks!
- Anonymous7 years ago
Hi Anonymous
I assume your row number column is serialised from 1 to .....
Create a calculated column using
YesNo =
IF (
Data[Amount]
= LOOKUPVALUE ( Data[Amount], Data[RowNo], Data[RowNo] - 1 ),
"Yes",
"No"
)Replace Data with your table name and Amount with your column name and RowNo with your column name.
Cheers
CheenuSing
2 Replies
- AnonymousNot applicable
Hi Anonymous
I assume your row number column is serialised from 1 to .....
Create a calculated column using
YesNo =
IF (
Data[Amount]
= LOOKUPVALUE ( Data[Amount], Data[RowNo], Data[RowNo] - 1 ),
"Yes",
"No"
)Replace Data with your table name and Amount with your column name and RowNo with your column name.
Cheers
CheenuSing
- AnonymousNot applicable
thnx a lot!