Dynamic label using liquid in a dimension/measure

I am trying to add a dynamic label using liquid for a dimension/measure. Below is my LookML,

measure: TotalAmount {
label: "{% FORMAT_DATETIME("%B %G", DATETIME(DATE_TRUNC(CURRENT_DATE,MONTH))) %}"
type: sum
value_format:"$#,##0.00;($#,##0.00)"
sql: ${TABLE}.Amount ;;
}
But this returns a bunch of errors

The code FORMAT_DATETIME("%B %G", DATETIME(DATE_TRUNC(CURRENT_DATE,MONTH))) run in BigQuery returns the value "November 2024" and I want this to be title/label of the dimension/measure and it would be "December 2024" in the next month (changing dynamically depending on the month/year we are in)

Is this possible using liquid in LookML? Or is there any other option?

Thanks in advance!  
Solved Solved
0 1 256
1 ACCEPTED SOLUTION

You can't run a query in Liquid HTML like that, so this will not work. Even if you could, it would only return a single result, so if the goal is to get your metrics broken out by month in the field picker, that would not work either.

View solution in original post

1 REPLY 1

You can't run a query in Liquid HTML like that, so this will not work. Even if you could, it would only return a single result, so if the goal is to get your metrics broken out by month in the field picker, that would not work either.

Top Labels in this Space
Top Solution Authors