Aggregating Date into a Custom Dimension

Hi Community! I’m trying to to aggregate 2 ranges of dates into 2 results in a custom dimension/table calculation. The goal is to have the top range from the below be Range 1 and the second Range 2. Any suggestions?

image

0 1 2,226
1 REPLY 1

There are two common ways you for you to do this

  1. Create a type:yesno dimension for each date range, having it be true when the date field of your choice. Once you created these two yesno dimensions you’ll need to create two dimensions for whatever it is you’d like to have in your final columns and use the filters parameter to filter for the timeframe. This will result in 4 new dimensions, 2 that filters for the date range and two that filter your data for display.

  2. Create two dimensions and within them, write a CASE WHEN statement that checks the date range and if it fits returns the value you’re interested in showing on your table.

The second option is more SQL intense and I think generally using Looker’s tools is recommended (as you are #1). In the end a lot of the choice comes down to if you’re using dimensions or counts and how you’d like to organize your code.

Top Labels in this Space