Forum Discussion
How do i filter using a max variable within a variable chain while creating a table
- Anonymous4 years ago
Hi user35131 ,
I checked your code and I think Table2 should be a virtual table in your calculated table code. We couldn't use MAX to determind the column [Date] in virtual table directly. So you will get this error. You can try MAXX function to do this.
Table = VAR _Table1 = "Pulled a table out of here" VAR _Table2 = ADDCOLUMNS ( _Table1, "rank_order", RANKX ( FILTER ( _Table1, [id] = EARLIER ( [id] ) ), [date],, ASC, DENSE ) ) VAR _Table3 = FILTER ( _Table2, [date] >= DATE ( YEAR ( MAXX ( _Table2, [Date] ) ), 01, 01 ) ) RETURN _Table3My Sample:
Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I got the same response that said cannot identify the table that contains [date] column.
Hi user35131 ,
I checked your code and I think Table2 should be a virtual table in your calculated table code. We couldn't use MAX to determind the column [Date] in virtual table directly. So you will get this error. You can try MAXX function to do this.
Table =
VAR _Table1 =
"Pulled a table out of here"
VAR _Table2 =
ADDCOLUMNS (
_Table1,
"rank_order", RANKX ( FILTER ( _Table1, [id] = EARLIER ( [id] ) ), [date],, ASC, DENSE )
)
VAR _Table3 =
FILTER ( _Table2, [date] >= DATE ( YEAR ( MAXX ( _Table2, [Date] ) ), 01, 01 ) )
RETURN
_Table3
My Sample:
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.