Offset as a lookml measure

low_priority
done
reply
(Jason Parks) #1

Hello, I am having an issue, trying to replicate a calculated table field in LookML using offset()

measure: offset {
hidden: no
label: “Offset”
type: number
value_format_name: gbp_0
sql: offset(${email_weekly_waterfall.calculated_gp},-1) ;; }

calculated_gp is above this in the sql.

When I run, it finds an error
“ERROR: syntax error at or near “offset” Position: 13846”

Anybody help with this please?

0 Likes

(Ben Silverstein) #2

Since you’d like to relate an individual row to data not available to the row directly, I think a window function is in order, meaning a derived table will be at least an option. This blog post may help - https://looker.com/blog/a-window-into-the-soul-of-your-data

0 Likes

(Jason Parks) #3

Hey Ben,

Thanks for coming back to me.
I’ve followed the guide and tried it out, unfortunately, it’s still causing an error for me.
I’ll re-try and see if I’ve missed a step.

0 Likes