Forum Discussion
LurkingDude
1 year agoFrequent Visitor
Find Average Using Most Recent Date
Hi, all. New to DAX (but with some database background) so have been struggling to solve a simple issue. I have a data model that tracks tournament results for chess players. Partial table structu...
- 1 year ago
hi AntrikshSharma ,
yes, indeed. thank you very much for pointing this out.
try like this instead:
measure =VAR _table =ADDCOLUMNS(SUMMARIZE(CALCULATETABLE(fResults,dMembers[Expiry]>TODAY()),dMembers[MemberID],dMembers[Expiry]),"RecentDate",CALCULATE(MAX(fResults[ResultDate])))VAR _result =CALCULATE(AVERAGE(fResults[NewRating]),TREATAS(_table,dMembers[MemberID],dMembers[Expiry],fResults[ResultDate]))RETURN _result
LurkingDude
1 year agoFrequent Visitor
Thanks for the response. Yes, this will calculate the average rating for all non-expired members. But it does not take the most-recent rating only from the results table--this is the challenge I am having.
Each active member may have literally hundreds of entries in the fResults table, each entry with a rating. I need to calculate the average on ONLY each member's most-recent rating.
Thanks.
AntrikshSharma
1 year agoCommunity Champion
LurkingDude Define most recent, unless you have a column such as LastUpdateDate you can't quantify most recent.
- LurkingDude1 year agoFrequent Visitor
fResults[ResultDate] is the date of the most-recent rating update. This field is related to the Date field in dCalendar.
Thanks again.