I need help on Looker Explore to explore the Sales Amount when user try to filter a date range for last one week. So the Tabulation report, need show data Sales Date, Sales Amount and Last Year Same period Sales Amount. My aggregate table in Bigquery having data in a grain like trans date, item and sales amount. Looker needs to query Current Date Filter range Sales amount and last year same period sales amount. Thanks in advance
Say Agg Table data has data
Date | Item | Sales Amount |
1/11/2023 | Icecream | $2 |
1/12/2023 | dougnut | $10 |
1/11/2024 | chocolate | $5 |
1/12/2024 | Icecream | $20 |
Looker Date Filter - 1/11/2024 to 1/12/2024 and explore output as
Date | Item | Sales Amount | Last Year Sales Amount |
1/11/2024 | Icecream | $2 | |
1/11/2024 | Chocolate | $5 | |
1/12/2024 | Icecream | $20 | |
1/12/2024 | dougnut | $10 |
If you pivot your explore on 'Date-year', you would get a column for each year of sales as you can see below:
Just filter your date field for the years you are interested in. You can pivot on a field by clicking this button:
If 'year' is not available in your date field, you can ask your data team to make it available on the front end.
I dont want to do Pivot. I will have two measures current_year_sales and last_year_sales. when the date filter say 01/01/2024 to 06/01/204. Then I need to bring data for current_year_sales for the date filter and last_year_sales from the same period last year