Question

Date Label Issue

  • 26 July 2022
  • 2 replies
  • 26 views

Hi Community,

I am new to looker.  I have mapped in a new model and in the view there are a number of Date fields.

All of them have added the  string “Date” to the end of the title.  I have tried to override with a label tag in the LookML but has made no difference.   Also seems to be no way to edit the title in the visualisation settings

Any ideas?

thanks

 


2 replies

Resolved its taking the Date Hierarchy Label , also figured out howto overwrite label

Please share your solution, so others with similar issue can benefit as well.

My go to solution is to do something like this

Explore


LookML code

  dimension_group: dim__updated {
group_label: "Date: Updated"
group_item_label: "{% assign tf = _field._name | split: '_' %}{{ tf | last | capitalize }}"
label: " Updated"
type: time
timeframes: [
raw,
time,
date,
week,
month,
quarter,
year
]
sql: ${TABLE}.updated_at ;;
}

What happens in ‘group_item_label’ is as follows
1. Get the field name e.g. “dim__updated_date”, “dim__updated_month”…
2. Split the retrieved value by  ‘_’, creating list of parts, e.g. ['dim', ' ', 'updated', 'date'], ['dim', ' ', 'updated', 'month'], …
3. Get the last element of the list e.g. 'date', 'month', …
4. Capitalise it and that becomes your ‘group_item_label’ e.g. “Date”, “Month”, ... 

Reply