Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

To flag latest value per category

Hey guys, I have this DAX column but want to transfer it to PQ. Can you help ?

 

Latest modified =
var latest_date = CALCULATE ( MAX ( Statistics[Modified DateTime] ), ALLEXCEPT ( Statistics, Statistics[ActionKey] ) ) // extracting latest Modified date per action
var latest_date_flag = IF ( Statistics[Modified DateTime] = latest_date, 1, 0 ) // flagging latest Modified date per action
return
latest_date_flag
  • Use Group By on the ActionKey column, select the Advanced radio button and you can add a column for the max Modified DateTime and also include all rows. Expand the resulting Table column and you can add a conditional column comparing the Modified DateTime to the max date time column

2 Replies

  • Hello - the current DAX column removes all context filters in the table except the filters for Statistics[ActionKey].  If this is really a calculated column and not a measure, you would need to provide more information on the other filters in use for Statistics[ActionKey] that are to be retained in order to convert this to Power Query.  To me though, I think this may be better suited as a DAX measure.

  • Use Group By on the ActionKey column, select the Advanced radio button and you can add a column for the max Modified DateTime and also include all rows. Expand the resulting Table column and you can add a conditional column comparing the Modified DateTime to the max date time column