Forum Discussion
patri0t82
Post Patron
3 years agoMeasure for MAX Date, for Every Record
Hello, I have two columns. Schedule[Date] and Schedule[Job], I'm trying to create a measure that finds the MAX [Date] for every record in [Job]. Some of the formulas I've tried (and no longer re...
- 3 years ago
My apologies. I misunderstood what you were after (I though you only wanted one name based on the last modified date). See if this measure returns what you expect (even in Direct Query?)
Latest Job by date = VAR _MaxDateTime = CALCULATE ( MAX ( 'Main Table'[ModifiedDate] ), FILTER ( ALLSELECTED ( 'Main Table' ), 'Main Table'[Name] = MAX ( 'Main Table'[Name] ) ) ) RETURN CALCULATE ( MAX ( 'Main Table'[Job] ), FILTER ( 'Main Table', 'Main Table'[ModifiedDate] = _MaxDateTime ) ) - 3 years ago
Thinkg about it, I don't think my last suggestion delivers what you need, since it shows the last job by name, but ignores that las modified date.
So see if this measure returns the job by last modified date:
Latest job by modified date = VAR _MaxDateTime = CALCULATE ( MAX ( 'Main Table'[ModifiedDate] ), FILTER ( ALLSELECTED ( 'Main Table' ), 'Main Table'[Job] = MAX ( 'Main Table'[job] ) ) ) RETURN CALCULATE ( MAX ( 'Main Table'[Job] ), FILTER ( 'Main Table', 'Main Table'[ModifiedDate] = _MaxDateTime ) )
patri0t82
Post Patron
3 years agoThank you!
PaulDBrown
Community Champion
3 years agoThinkg about it, I don't think my last suggestion delivers what you need, since it shows the last job by name, but ignores that las modified date.
So see if this measure returns the job by last modified date:
Latest job by modified date =
VAR _MaxDateTime =
CALCULATE (
MAX ( 'Main Table'[ModifiedDate] ),
FILTER (
ALLSELECTED ( 'Main Table' ),
'Main Table'[Job] = MAX ( 'Main Table'[job] )
)
)
RETURN
CALCULATE (
MAX ( 'Main Table'[Job] ),
FILTER ( 'Main Table', 'Main Table'[ModifiedDate] = _MaxDateTime )
)
- patri0t823 years ago
Post Patron
Ahh, you're right. Great catch, and thank you again!!