Forum Discussion
Return Value based on highest number, comparing rows
- 5 years ago
Anonymous , Try
new column = if([YearMonth] = maxx(filter(table, [ID] = earlier([ID])),[YearMonth]),1,0)
or
new measure = if(max(Table[YearMonth]) = maxx(filter(allselected(table), [ID] = max([ID])),[YearMonth]),1,0)
- 5 years ago
Hi, Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create a custom column with following m codes.
let id=[ID], maxyearmonth=List.Max( Table.SelectRows(#"Changed Type",each [ID]=id)[YearMonth] ) in if [YearMonth]=maxyearmonth then 1 else 0Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create a custom column with following m codes.
let
id=[ID],
maxyearmonth=List.Max(
Table.SelectRows(#"Changed Type",each [ID]=id)[YearMonth]
)
in
if [YearMonth]=maxyearmonth
then 1 else 0
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.