I implemented a POP analysis based on the above article.
The parameters to be entered are as follows.
_PoP 1. Current Date Range: 2024/04/01~2024/04/08
_PoP 2. Compare To:
Previous Period
There is only one thing to correct,
I want to be able to aggregate by the period of the date entered in the Current Date Range.
The query generated from the LookML I created is as follows.
Currently, it is designed to aggregate the period from 2024/04/01~2024/04/07.
Hello ryukiman07,
If I understand correctly, your issue is with the end date: the logic is not including the end date entered by the user. I would note that this is the standard way that date ranges are used in looker filters: the end date is typically excluded.
That said, you can try to work around this (if you can be sure your users will expect this to be inclusive of the end date).
If you based your code of the linked article, you will find multiple uses of {% date_end [filter/field_name] %}. You would need to adjust those references by adding one day to them presumably with date_add sql.
Elsewhere, you will see {% condition current_date_range %}. In that case, you will need to convert to managing the range with date_start and date_end (similar to what is done for period_2), because as mentioned above: looker standard behavior (what condition block will do) will not include the end date of a date range.
I hope this helps conceptually - as you can see you will need to apply updates in multiple places to adjust how this range is handled - you will need to carefully adjust all those checks that happen against the end date of the user date selection. And be sure to check closely that the days_in_period calculation and other helper calculations are all working correctly.
You can try this approach too for Periodic Analysis
Solved: How to implement DatesYTD and DatesMTD using Look... - Google Cloud Community