how to create my own customise static dimentions in explore/looker

 I want to create new dimentions /fields and also want to insert my own values.

what will be the code syntax to achieve this in explore ? what will be the lookml script for this?

for an example:

I want create one field name called: "bucket names" and I want to insert my own vales like "autopricing","non-autopricing" etc. how will i do that in explore?

bucket names
 
auto pricing 
non-autopricing
activeprice
currprice
saleprice
 
Solved Solved
0 13 4,167
2 ACCEPTED SOLUTIONS

You can create dummy dataset using sql, and then use that SQL within the dimension sql parameter in LookML view.

In below example I have made dummy data in BigQuery. you can do it based on the database you are using.

 
select "auto pricing" as bucket_names
union all
select "non-autopricing" as bucket_names
union all
select "activeprice" as bucket_names
 
LookML:
 
dimension: bucket_names {
sql: (
select "auto pricing" as bucket_names
union all
select "non-autopricing" as bucket_names
union all
select "activeprice" as bucket_names
)
type: string
}
 
Hope that helps !

View solution in original post

@shetu - Do you want to create the static dimension in Looker or in BigQuery?

The solution I gave earlier is to create it in Looker. To create this static table in BQ you can just use the below script with proper project and dataset names.

 
CREATE or REPLACE VIEW <project>.<dataset>.looker_test_1 AS
    select "auto pricing" as bucket_names
    union all
    select "non-autopricing" as bucket_names
    union all
    select "activeprice" as bucket_names
    ORDER by 1;
 
 
~Ashish

View solution in original post