In some business scenarios, administrative users have a calendar master table with future entries, and at the same time, they might desire to show Month elements until today. Follow the steps below to achieve this requirement. In this scenario, the Month attribute has numeric YYYYMM format.


The SQL of this Element Prompt against an Oracle warehouse is as seen below:
Sql
select a11.MONTH_ID MONTH_ID
from LU_MONTH a11
where a11.MONTH_ID <= ((TO_NUMBER(TO_CHAR(TRUNC(CURRENT_DATE), 'YYYY')) * 100) + TO_NUMBER(TO_CHAR(TRUNC(CURRENT_DATE), 'MM')))
order by 1 desc