Daasity Knowledge Base
Daasity Knowledge Base
  • Start here
    • Daasity Overview
    • Important Concepts
      • Attribution Overview
      • What is a Daasity Valid Order?
      • Customer Householding
      • Timezones in Daasity
      • Ecommerce Glossary
      • Daasity Data Security Overview
    • Retail Analytics 101
      • Understanding the Basics: POS Data 101
      • How to use Syndicated Data
    • Product Changelog
    • Feature Requests
  • πŸ”ŒExtract
    • Extract your data with Daasity
    • All Integrations
      • Alchemer
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Algolia
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Amazon Advertising
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
        • Where to Find Your Data
      • Amazon Seller Central
        • Validating Your Amazon Data in Daasity
          • Comparing Your Amazon Seller Central Orders to Daasity
        • Integration Setup
          • Configure Amazon Reports
          • Monitor Amazon Reports
        • Integration Specifications
          • Orders API
          • FBA Customer Concessions Reports
          • FBA Sales Reports
          • FBA Inventory Reports
          • FBA Removals Reports
          • Inventory Reports
          • Order Tracking Reports
          • Performance Reports
          • Returns Reports
          • Settlement Reports
          • Seller Retail Analytics Reports
        • Workflow Configuration Setup
          • Orders API
          • FBA Customer Concession Reports
          • FBA Inventory Reports
          • Performance Reports
          • FBA Sales Reports
          • FBA Removal Reports
          • Inventory Reports
          • Order Tracking Reports
          • Returns Reports
          • Seller Retail Analytics Reports
          • Settlement Reports
        • Transformation Configuration Setup
          • Orders API
          • FBA Customer Concessions Reports
          • FBA Inventory Reports
          • Performance Reports
          • FBA Sales Reports
          • FBA Removals Reports
          • Inventory Reports
          • Order Tracking Reports
          • Returns Reports
          • Seller Retail Analytics Reports
          • Settlement Reports
      • Amazon Vendor Central
        • Integration Setup
        • Integration Specifications
        • How to use
        • ASIN Mapping Configuration Setup
        • Workflow Configuration Setup
        • Transformation Configuration Setup
          • Vendor Sales & Inventory Report
          • Vendor Traffic Report
      • AppLovin
        • Integration Setup
      • Attentive Mobile
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Azure SQL Database
      • Back In Stock
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Big Commerce
        • Integration Setup
          • Connect Daasity From BigCommerce Marketplace
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • BigQuery Datasource
      • Bing Ads
        • Integration Setup
        • Integration Specifications
      • Circana
        • Integration Setup
        • Integration Specifications
        • Data Release Calendar
        • H-E-B Circana
      • Cordial
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Criteo
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • D​ata File (CSV, XLS)
      • Emplifi
        • Integration Specifications
      • Extensiv (Skubana)
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Facebook Ads
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
        • Where to Find Your Data
      • Fairing V2
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Important Notes
      • Google Ads
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
        • Important Notes
      • Google Analytics 4
        • API vs BigQuery
        • API Integration
          • Integration Setup
          • Integration Specifications
          • Workflow Configuration Setup
          • Transformation Configuration Instructions
          • Custom Reports
          • Validating GA4 Data in Daasity
          • Blending Universal Analytics & GA4 Data
        • BigQuery integration
          • Integration Setup
          • Integration Specifications
          • Workflow Configuration Setup
          • Transformation Configuration Instructions
          • Important Notes
          • Creating a Custom Report
      • Google Sheet
      • Gorgias
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
        • Important Notes
      • Impact Radius (Beta)
        • Integration Specifications
      • Iterable
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Klaviyo Summary Statistics
        • Integration Setup
        • Integration Specifications
      • Klaviyo V2
        • Integration Setup
        • Integration Specifications
      • KnoCommerce
        • Integration Setup
        • Integration Specifications
      • Loop Returns
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Microsoft SQL Server Database
      • Mongo Database
      • MySQL Database
      • Narvar
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • NetSuite
      • Newstore
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Northbeam
        • Integration Setup
      • Okendo
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Ometria
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Order Desk
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Pepperjam
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Pinterest
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Postgres Database
      • Postscript (beta)
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
        • Important Notes
      • Recharge
        • Integration Setup
        • Integration Specifications
        • Integration Specifications (2021-11 Beta)
        • Workflow Configuration Setup
        • Transformation Configuration Setup
        • Recharge Data and Known Discrepancies
      • Retail Next
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Rockerbox
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Salesforce Commerce Cloud
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • SFTP
      • ShipBob
        • Integration Setup
        • Integration Specifications
      • Shipstation
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Shopify
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
        • Shopify B2B Data
      • SKIO
        • Integration Setup
        • Integration Specifications
      • Snapchat
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • SPINS
        • Integration Setup
        • Integration Specifications
        • How to Use
        • Data Release Calendar
      • Stay Ai
        • Integration Setup
        • Integration Specifications
      • Target Plus
        • Integration Setup
      • Thankful
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • TikTok
        • Integration Setup
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Walmart Marketplace
        • Integration Setup
        • Integration Specifications
      • Whole Foods Market
        • Integration Setup
        • Integration Specifications
        • How to use
      • Yotpo
        • Integration Setup
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
      • Zendesk
        • Integration Specifications
        • Workflow Configuration Setup
        • Transformation Configuration Setup
    • Brand Supplied Data (BSD)
      • BSD Overview
      • Monitoring Your BSD Progress
      • Revenue Plan
      • Marketing Budget
      • Marketing Spend
      • RFM Values
      • Shipping & Fulfillment Cost
      • SKU Hierarchy
      • SKU Mapping
      • SKU Cost
      • Discount Code Mapping
      • Other Order Sources
      • Channel Mapping
        • Overview & Setup
        • Filling out Channel Mapping
        • Missing from GA & Missing from BSD
      • Configuration
  • πŸ“ŠVISUALIZE
    • Dashboards
      • Dashboard Overview
      • Standard Dashboards
        • Daasity 101 Overview Dashboards
          • Flashes
          • Shopify Sales Report
          • Account Health
        • Digital Product & Revenue
          • Orders and Revenue
          • Amazon Settlement Report
          • Product Repurchase Rate
          • Product
            • Product Dimensions
              • Why is a Product Name NULL?
          • Inventory
          • Operations
            • Fulfilment Status Options
        • Retention Marketing Dashboards
          • Notifications (Email/SMS)
          • Retention
          • Customer Performance (Email/SMS)
          • Site Funnels
        • Acquisition Marketing Dashboards
          • Attribution Deep Dive
            • Marketing Attribution
              • Attribution Overview
              • Survey-Based Attribution
              • Discount Code Attribution
              • First Click, Last Click, and Assisted Attribution
              • Custom Attribution
              • Vendor-Reported Attribution
              • CPO, CPA, and CAC
              • Missing from GA & Missing from BSD
          • LTV & RFM
            • RFM
              • RFM in the Daasity App
              • Understanding RFM
              • Time on Books (TOB)
          • Marketing
          • Vendor-Reported Marketing Performance
          • Site Analytics & Attribution
      • Integration Dashboards
        • Amazon All Orders Report
        • Amazon Seller Central Business Reports
        • Gorgias
        • Klaviyo Campaign & Flow Performance
        • Loop Returns
        • Okendo Reviews
        • ShipBob
        • Shipstation
        • Subscription
        • Walmart Marketplace Account Sales Report
        • Yotpo
    • Explores
      • Explore Overview
      • Order Line Revenue vs. Transactional Sales Report
      • How to Access An Explore
      • Standard Daasity Explores
        • Current Inventory Level Explore
        • Customer Details Explore
        • Daily Company Metrics Explore
        • Daily Marketing Plan To Actual Marketing Performance Explore
        • Daily Plan to Actual Explore
        • Lifetime Value Explore
        • Marketing Attribution Explore
        • Multi-Channel Transaction Explore
        • Order and Order Line Revenue Explore
        • Product Page Explore
        • Shopping Stage Explore
        • SKU Level Repurchase Rates Explore
        • Traffic Explore
        • Transactional Sales Report Explore
        • UA vs G4 Explore
      • Integration Explores
        • Algolia
        • Amazon Settlement Explore
        • Fairing Survey Responses Explore
        • Gorgias Tickets Explore
        • Loop Returns Explore
        • Okendo Reviews Explore
        • Subscribers and Subscription Monthly Churn Rates Explores (Recharge)
        • Shipstation Explore
        • Yotpo
        • Zen Desk
    • Looker Guides
      • Building visualizations
      • Working with date dimensions & filters
      • Schedule a Report or Dashboard
      • Exporting Data
    • Looker Guides (Developer)
      • Daasity Hub & Spoke Introduction
      • Hub & Spoke File Structure
      • Working with LookML Dashboards
      • Customizing Base Daasity Code
    • Visualize using other BI tools
  • πŸ”€Transform
    • Transforming Data with Daasity
    • Daasity Data Models
      • Daasity Data Model Overview
      • Unified Data Schemas
        • Unified Schema Introduction
        • Unified Order Schema (UOS)
        • Unified Notification Schema (UNS)
        • Unified Subscription Schema (USS)
        • Unified Marketing Schema (UMS)
        • Unified Traffic Schema (UTS)
        • Unified Wholesale Schema (UWS)
      • Data Mart Models
        • Data Mart Introduction
        • Data Reporting Platform (DRP)
        • Channel Attribution Data Mart
        • Marketing Data Mart
      • Transform Code
        • Transform Code Introduction
        • Transform Code Sequence - DRP
        • Initialization Code
        • Householding Code
        • Order Status Code
        • Order Channel and Marketing Code
        • Daily Plan Code
        • Order and Order Line Revenue
        • Plan to Actual Code
        • Customer Code
        • Subscription Code
        • Reviews
        • Life-Time Value Code
        • Returns
        • Product and Inventory Code
        • Email & SMS
        • Transform Code Sequence - Data Mart
        • Unified Order Schema (UOS) Code
        • Unified Marketing Schema (UMS) Code
        • Unified Notification Schema (UNS)
        • Channel Attribution Data Mart Code
        • Marketing Data Mart Code
      • Source to Final Destination
    • Code Repository
      • Code Repository Overview
      • Getting Access to Your Code Repository
      • Code Repository Branches
      • Custom SQL Code
      • Custom Script Manifest Files
    • Script Manifest (YAML) Files
  • 🎡Data Orchestration
    • Workflows
      • Getting Started with Workflows
      • Creating Workflows
      • Managing Workflows
      • Workflow Metrics
    • Notifications
      • Introduction to Notifications
      • Enabling Notification Emails
      • Notifications UI
      • Managing Notifications
      • Authorization List
  • Audiences
    • Audiences Overview
    • Pushing Audience Data to Targets
      • Targets Overview
      • Attentive
        • Events Target
        • Subscribers Target
        • Target Endpoint Documentation
      • Facebook Ads
        • Facebook Target
        • Target Endpoint Documentation
      • Google Ads
        • Google Ads Target
        • Target Endpoint Documentation
      • Klaviyo
        • Events Target
        • Profiles Target
        • Target Endpoint Documentation
      • Sailthru
        • Events Target
        • Users Target
        • Target Endpoint Documentation
      • Tiktok Ads
        • TikTok Target
        • Target Endpoint Documentation
    • Building Audiences
  • warehouse
    • BigQuery
    • Redshift
    • Snowflake
    • Test Data Warehouse
      • Test Data Warehouse Overview
      • Create a Snowflake Test Warehouse
      • Create a Redshift Test Warehouse
  • β€”
    • Go to Daasity App
    • Contact Support
    • ✍️Feature Requests
Powered by GitBook
On this page
  • What are refinements?
  • How do refinements work?
  • Creating refinement files
  • More refinement examples

Was this helpful?

  1. VISUALIZE
  2. Looker Guides (Developer)

Customizing Base Daasity Code

PreviousWorking with LookML DashboardsNextVisualize using other BI tools

Last updated 5 months ago

Was this helpful?

What are refinements?

Refinements are how you will customize the Base Daasity explores and views to your business needs.

Refinements are a feature of Looker that allow you to overwrite and append LookML code without editing the original code directly. This is useful for customizing imported files β€” which power the Hub & Spoke setup β€” since there is no way to edit them directly.

This article is meant to help you understand the most important aspects of refinements. If there are questions we have not answered here, you may be able to find the answers in.

How do refinements work?

Refinements are contained in generic .lkml files. They are formatted similarly to normal explore and view files, but with some key differences. When Looker processes a refinement, it meshes the content of the refinement with the contents of the original object that is being refined. In pretty much all cases, the contents of the refinement will take precedence over the contents of the original.

In refinement files, you'll reference a view or explore that already exists in the imported files β€” the only difference being that you will precede them with a "+". Then you can overwrite existing elements of the original views and explores, or you can add fields and parameters to them.

The diagram below shows a basic example of refining a single field from a Base Daasity view. There are two files: the original order_line_revenue.view.lkml file that is imported from the hub, and the order_line_revenue_refinements.lkml file from the spoke, which contains the refinements. The output section of the diagram shows how the contents of the two files mesh together:

In this example, the refinement file modifies the net_sales measure in two ways: 1. adding a group label and 2. changing which database column is aggregated by the measure.

The net_sales measures in both files include a sql parameter, but with different contents. In situations like this, the contents of the refinement take precedence and overwrite the original value.

There is no group_label defined in the original net_sales measure, but we are defining it in the refinements. So the net_sales output inherits the group_label from the refinement.

Note that we only need to include the parameters in the refinement that we are overwriting or adding. All of the other parameters that we didn't specify in the refinement will just be kept intact from the original object.

Keep reading for more examples for specific use cases.

Creating refinement files

We recommend you keep all of your refinement files within the base_refinements folder.

Refinement files are generic LookML files β€” not view or explore files. They are the last option in the Add a file or folder menu:

A refinement file always contains at least 2 parts:

  1. At least 1 include parameter

    • The value of the parameter should be the path of the file that contains the base explore or view that you're refining. Note that if you're referencing a file in the imported base_daasity project, you need to start the path with double-slashes (//)

    • This makes the contents of the Base Daasity explore or view file available for refinement

  2. At least 1 explore or view parameter

    • This contains the identifier of the explore or view that you're refining, prefixed with a "+" sign. The "+" sign tells Looker that this is a refinement of an existing object

    • Your refinements will live within this parameter

If we wanted to create a refinement files for the Base Daasity Marketing Performance explore, the file would need to be set up like this:

include: "//base_daasity/explores/marketing_performance.explore.lkml" # Makes the contents of the marketing_performance explore file available for refining

explore: +marketing_performance { # Identifies the original explore that's being refined, with the "+" prefix
  # Refinements go here
}

If we wanted to create a refinement file for the Base Daasity Master Spend view, the file would need to be set up like this:

include: "//base_daasity/views/ums/master_spend.view.lkml" # Makes the contents of the master_spend view file available for refining

view: +master_spend { # Identifies the original view that's being refined, with the "+" prefix
  # Refinements go here
}

More refinement examples

Adding a new dimension/measure to an existing view

Daasity out of the box gives you a Cost per Thousand Impressions measure in the Marketing Performance explore that is calculated as ${total_spend} / (1000 * ${total_impresssions}).

But let's say you want to create an additional, slightly different measure that gives you the spend for each impression, called Cost per Impression.

In this example, we're refining the original Base Daasity master_spend view, which is in the following file: //base_daasity/views/ums/master_spend.view.lkml

The contents of the refinement file would look like the following:

/base_refinements/views/ums/master_spend.lkml
include: "//base_daasity/views/ums/master_spend.view.lkml" # ☝Makes the contents of the master_spend view file available for refining

view: +master_spend {

  measure: cost_per_impression { # New measure added here & defined below
    group_label: "Metrics"
    label: "Cost per Impression"
    type: number
    sql: ${total_spend} / NULLIF(${total_impressions},0)
    value_format_name: decimal_4
    html: {{ currency_symbol_converted._value }}{{ rendered_value }};;
  }

}
Modifying an existing dimension/measure

Let's say you wanted to hide the attribution_window dimension from the master_spend view because your end users don't know enough about attribution windows for them to be relevant.

Here is what the original attribution_window dimension looks in the Base Daasity file:

//base_daasity/views/ums/master_spend.view.lkml
view: master_spend {
  label: "Master Spend"
  sql_table_name: ums.master_spend ;;
  
  ...
  
  dimension: attribution_window {
    type: string
    description: "Attribution window used to determine vendor-reported orders and revenue"
    label: "Attribution Window"
    hidden: no
    sql: ${TABLE}.attribution_window ;;
  }
  
  ...
  
}  

The contents of the refinement file would look like the following:

/base_refinements/views/ums/master_spend.lkml
include: "//base_daasity/views/ums/master_spend.view.lkml" # Makes the contents of the master_spend view file available for refining

view: +master_spend { # Identify the view to refine, with a "+" prefix

  dimension: attribution_window { # Identify the field to refine
    hidden:yes # Add only the parameter(s) you want to override
  }

}

In the above code block, you're just using the same dimension identifier as in the Base Daasity view and adding the hidden: yes parameter. Simple as that. You just need to deploy the code, and now this field will be hidden in any explores that contain it.

You only need to include parameters that you want to modify or add. All of the other parameters that are defined for attribution_window in the Base Daasity view will remain intact.

Joining a custom view to an existing Base Daasity explore

In this example, you have created a new, custom view in your custom folder. This new view has date-specific information that you want to join to your Base Daasity order_line_revenue explore. The view name is date_notes and it's in the following file: /custom/date_notes.view.lkml

Here's what the refinement file might look like:

/base_refinements/explores/order_line_revenue.lkml
include: "//base_daasity/explores/order_line_revenue.explore.lkml" # Makes contents of the order_line_evenue explore file available for refining
include: "/custom/date_notes.view.lkml" # Makes contents of the custom date_notes.view.lkml file accessible. This is necessary to join it with the refined explore

  explore: +order_line_revenue { # Identify the explore to refine, with a "+" prefix
    join: date_notes { # Identify the view to join to order_line_revenue
      type: left_outer # Define the type of join
      relationship: one_to_one # Define the relationship of the join
      sql_on: ${retail_calendar.calendar_date} = ${date_notes.date} # Define which fieds to join on
    }
}

Note that even though the order_line_revenue explore joins to a handful of other views, we don't need to include those other joins in the refinement. When you specify a new join in an explore refinement, it adds that join to the other joins already defined in the Base Daasity explore file β€” it doesn't override the other joins.

Hiding a Base Daasity explore

In this example, you have created a completely custom Order Line Revenue explore in your custom folder and want to hide the Base Daasity Order Line Revenue explore to avoid confusion and ensure end users use the custom version instead.

The refinement file might look like this:

/base_refinements/explores/order_lilne_revenue.lkml
include: "//base_daasity/explores/order_line_revenue.explore.lkml" # Makes contents of the order_line_evenue explore file available for refining

  explore: +order_line_revenue { # Identify the explore to refine, with a "+" prefix
    hidden: yes # Adds the hidden: yes parameter to the Base Daasity explore, hiding it from the explore menu
}
image
πŸ“Š
Looker's LookML refinements documentation