Created
April 6, 2023 12:15
-
-
Save jrosell/edb3a89127f49edc8a08bbe18b35bfbd to your computer and use it in GitHub Desktop.
Google Looker Studio snippets to help in the creation of helper date dimensions in string format.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create my_date_month custom field from existing date field my_date | |
MONTH(my_date) | |
// Create my_date_YYYYMM ucstom field from existing numeric field my_date and my_date_month | |
CASE | |
WHEN my_date_month=1 THEN CONCAT(YEAR(my_date),'01') | |
WHEN my_date_month=2 THEN CONCAT(YEAR(my_date),'02') | |
WHEN my_date_month=3 THEN CONCAT(YEAR(my_date),'03') | |
WHEN my_date_month=4 THEN CONCAT(YEAR(my_date),'04') | |
WHEN my_date_month=5 THEN CONCAT(YEAR(my_date),'05') | |
WHEN my_date_month=6 THEN CONCAT(YEAR(my_date),'06') | |
WHEN my_date_month=7 THEN CONCAT(YEAR(my_date),'07') | |
WHEN my_date_month=8 THEN CONCAT(YEAR(my_date),'08') | |
WHEN my_date_month=9 THEN CONCAT(YEAR(my_date),'09') | |
WHEN my_date_month=10 THEN CONCAT(YEAR(my_date),'10') | |
WHEN my_date_month=11 THEN CONCAT(YEAR(my_date),'11') | |
WHEN my_date_month=12 THEN CONCAT(YEAR(my_date),'12' | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment