Skip to main content
Nov 13, 2022 7:33 AM UTC
Question

How to consider last value of a column in filter statement?

I’m trying to use filter table.column = LAST(table.column)

im getting error

tried taking last(table.column) in a variable to use in case when but getting error that dimension function cannot be used with aggregation function

3 replies

Nov 13, 2022 4:21 PM UTC

Hi Preethi,

 

Here is what you need to do, change the variable to static type

 

image.png 

Now put the last function, now use the variable. In this example I am doing last as Year which is 2030

 

image 

imageHope this helps !

Nov 14, 2022 6:28 AM UTC

Hi Preethi,

 

Here is what you need to do, change the variable to static type

 

image.png 

Now put the last function, now use the variable. In this example I am doing last as Year which is 2030

 

image 

imageHope this helps !

Hi @abhishek.chatu14​ 

Thank you for your response

This works fine for a date column. But we have created a week column to calculate weeks for every quarter value like ‘Q1-W01’

how to get last value from this?

Nov 14, 2022 11:49 AM UTC

Hi @abhishek.chatu14​ 

Thank you for your response

This works fine for a date column. But we have created a week column to calculate weeks for every quarter value like ‘Q1-W01’

how to get last value from this?

In that case with some tweaks you can use MAX (as long as you don't mix week numbers from 2 years)