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.
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)
- Anonymous5 years agoNot applicable
Awesome, that did the job!
Any chance I could do the same in Power Query?
I'd love to hear it!