Skip to main content
Question

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

  • November 13, 2022
  • 3 replies
  • 8 views

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

abhishek.chatu14
Level 11
Forum|alt.badge.img+4

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 !


  • Author
  • Level 7
  • November 14, 2022

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 Chaturvedi 

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?


Hi @Abhishek Chaturvedi 

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)