Merged PR 2158: Allow last day of the month to appear on 1st of month

As today it's 1st of July, the logic of selecting all days of the current month for MTD purposes on the business KPIs is ko, since we select up to yesterday.
This PR allows to consider the last day of the previous month as 'current month' only for the first day of the following month, thus ensuring that the most up-to-date data is always displayed in the MTD tab.

Related work items: #17745
This commit is contained in:
Oriol Roqué Paniagua 2024-07-01 07:53:38 +00:00
parent d9fcf65a67
commit a3b1decb08

View file

@ -36,7 +36,10 @@ select distinct
rd.last_day_month,
case when rd.date = rd.last_day_month then 1 else 0 end as is_end_of_month,
case
when date_trunc('month', rd.date) = date_trunc('month', rd.today) then 1 else 0
when date_trunc('month', rd.date) = date_trunc('month', rd.today) then 1
-- If today is 1st of Month, include last day of month for MTD display
when rd.today = rd.last_day_month + 1 then 1
else 0
end as is_current_month
from raw_dates rd
where