MAXROW() not returning key

I am using MAXROW to return the last record added to a child table but with an expression included:

MAXROW(“Current”, “_ROWNUMBER”, ([_THISROW].[Key] = [Member]))

“Current” is actually a slice of a table called History because I needed to conditions two my expression and I got the same result when trying that so I added a slice. Ideally my expression would be this:

MAXROW(“History”, “_ROWNUMBER”, (AND([_THISROW].[Key] = [Member],“Current” = [_Filter]))

I have a Members table and for each Member I have a history of status changes in a History table. The data in my History Tables is as follows:

_RowNumber Key Member Status Section _Filter
[Number] [Text] [Ref] [Ref] [Ref] [Text]
2 8cc13f6a 284bc465 I d3be1b10 Future
3 9a8847f9 284bc465 I be46f2a0 Future
4 76fc95db 284bc465 O be46f2a0 Future
5 d2685b57 284bc465 S be46f2a0 Current
6 38927c8f 284bc465 O eef91aea Future
7 3032901f 7d792ad5 S d3be1b10 Current
8 a3a3487a 7d792ad5 S be46f2a0 Current
9 b9146e21 7d792ad5 O eef91aea Future

In testing, I am returned the value “7d792ad5” which matches the Key of the member and not “a3a3487a” which is the key of the row in History table.

I was hoping actually that I would get the value “Started” but if I have the row key I can then do a LOOKUP to get the full text string.

Any thoughts?

Solved Solved
0 17 454
1 ACCEPTED SOLUTION

This worked:

LOOKUP(MAXROW(“Current”, “_ROWNUMBER”, ([_THISROW].[Key] = [Member])),“History”,“Key”,“Status”)

I suspect I could now get rid of my slice but after many hours on this, I will stick for now. Perhaps tomorrow I will re-insert the AND()

Many thanks for the help - very much appreciated

View solution in original post

17 REPLIES 17
Top Labels in this Space