Looker Connect Training
Help Center
Documentation
Community
Cloud Certifications
Last tested: Mar 1, 2021 Unlike several other "diff" functions (example: diff_days, diff_hours, etc) that we offer in our Looker Functions and Operators doc, we don't have a native function to create diff_quarters! In the example below, we'll create a diff_quarter function between order_items.returned_quarter and orders.created_quarter.Steps:First, we'll start by creating a diff_days_for_quarter function from the two quarters we've selected. We are extracting the months and years from each quarter and then turning that into a date. Once that's done, we are able to use the diff_days function and find the absolute value: abs(diff_days(date(extract_years(${order_items.returned_quarter}), extract_months(${order_items.returned_quarter}), 01), date(extract_years(${orders.created_quarter}), extract_months(${orders.created_quarter}), 01))) Next, we'll reference this diff_days_for_quarter function in another calculation, writing something like this: round(${diff_days_for_quarter}/91.75,0) We a
Last tested; Feb 1, 2021 You may notice that when you select the week dimension and some other fields, your data looks alright!However, when you add in your month dimension, some of your week rows are duplicating!Why is this happening? In this case, we can see 2020-12-28 getting repeated. This is because this week starts in the month 2021-012 and ends in 2021-01. There are two of the same week values, but they're getting correlated to two different months, causing the duplication.How can we fix it? We can add in a table calculation to extract the month. This will correlate the week to the month it starts in. This content is subject to limited support.
Last tested: Feb 9, 2021 Even if you have a value in the pivot subparameter of your query parameter, queries with pivots need to have the pivot defined in both pivots AND in dimensions.Example:query: orders_by_brand_name { dimensions: [products.brand, products.category] measures: [products.count, order_items.order_count] pivots: [products.category] description: "Orders by brand name" limit: 500} You can see that products.category is included in both the dimensions and pivots subparameter. This content is subject to limited support.
Already have an account? Login
No account yet? Create an account
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.