Forum Discussion
Minkee
2 years agoRegular Visitor
Calculation for highest date for same ID value
Hi, I am developing a report in PowerBI Desktop. When a value in the column ID is shown multiple times I want the last column to contain a '1' for the row with the highest enddate. ID St...
- 2 years ago
Hi Minkee,
You can try such a calculated column:
DAX code in plain text for convenience:
Flag = VAR currentID = [ID] VAR _tbl = FILTER ( Data, [ID] = currentID ) VAR maxDate = IF ( COUNTROWS ( _tbl ) > 1, MAXX ( _tbl, [Enddate] ) ) RETURN IF ( [Enddate] = maxDate && COUNTROWS ( _tbl ) > 1, 1, 0 )Best Regards,
Alexander
barritown
2 years agoSolution Sage
Hi Minkee,
You can try such a calculated column:
DAX code in plain text for convenience:
Flag =
VAR currentID = [ID]
VAR _tbl = FILTER ( Data, [ID] = currentID )
VAR maxDate = IF ( COUNTROWS ( _tbl ) > 1, MAXX ( _tbl, [Enddate] ) )
RETURN IF ( [Enddate] = maxDate && COUNTROWS ( _tbl ) > 1, 1, 0 )
Best Regards,
Alexander