Forum Discussion
Get First and Last Date from Group
- Anonymous6 years ago
Just incase anyone googles this in the future and needs the answer - here you go:
Earliest = Calculate(min(Mail[DateTimeReceived]),filter(mail,Mail[subject]=earliest(Mail[Subject])))
And
Latest = Calculate(max(Mail[DateTimeReceived]),filter(mail,Mail[subject]=earliest(Mail[Subject])))
As for the error: Cannot convert value from text to Yes/No;
You have to actually filter something. FILTER(TABLE,EXPRESSION)
Table = mail <-- your table
Expression = Mail[Subject] <-- your column
You might want to filter a specific subject text, i.e. FILTER(mail,Mail[Subject]="Subjectname")
The better question here might be then - How do you replicate a SQL GroupBY clause in DAX
- Anonymous6 years agoNot applicable
I am now trying the following moving away from the Filter
StartDate = CALCULATE(MIN(Mail[DateTimeReceived]),Groupby(Mail,Mail[Subject]))But now I get a circular dependency on mail[startdate]....- Anonymous6 years agoNot applicable
Just incase anyone googles this in the future and needs the answer - here you go:
Earliest = Calculate(min(Mail[DateTimeReceived]),filter(mail,Mail[subject]=earliest(Mail[Subject])))
And
Latest = Calculate(max(Mail[DateTimeReceived]),filter(mail,Mail[subject]=earliest(Mail[Subject])))