Thanks for your suggestions Mark and Rboggs1–The article you provided gave some idea. I came up with below code which I feel it is working for now
have to test it thoroughly.
- First, I have a db column Fiscal Year which always have current fiscal year.
- We have fiscal month (stores 1,2,3…12) and fiscal quarter (stores 1,2,3,4).
I created two filters in universe.
Current Period Filter
“Invoice Date”.FSCL_YR_NO=to_number(@Prompt(‘Enter Year No/Year and Quarter No/Year and Month No:’,‘A’,Mono,Free))
or
{fn concat(“Invoice Date”.FSCL_YR_NO,“Invoice Date”.FSCL_QTR_NO)}=({fn substring(to_number(@Prompt(‘Enter Year No/Year and Quarter No/Year and Month No:’,‘A’,Mono,Free)),1,4)})||
{fn substring(to_number(@Prompt(‘Enter Year No/Year and Quarter No/Year and Month No:’,‘A’,Mono,Free)),5,1)}
or
{fn concat({fn concat(“Invoice Date”.FSCL_YR_NO,‘0’)},“Invoice Date”.FSCL_MO_NO)}=
({fn substring(to_number(@Prompt(‘Enter Year No/Year and Quarter No/Year and Month No:’,‘A’,Mono,Free)),1,4)})||
{fn substring(to_number(@Prompt(‘Enter Year No/Year and Quarter No/Year and Month No:’,‘A’,Mono,Free)),5,3)}
Prior Period Filter
“Invoice Date”.FSCL_YR_NO=to_number(@Prompt(‘Enter Year No/Year and Quarter No/Year and Month No:’,‘A’,Mono,Free))-1
or
{fn concat(“Invoice Date”.FSCL_YR_NO,“Invoice Date”.FSCL_QTR_NO)}=({fn substring(to_number(@Prompt(‘Enter Year No/Year and Quarter No/Year and Month No:’,‘A’,Mono,Free)),1,4)}-1)||
{fn substring(to_number(@Prompt(‘Enter Year No/Year and Quarter No/Year and Month No:’,‘A’,Mono,Free)),5,1)}
or
{fn concat({fn concat(“Invoice Date”.FSCL_YR_NO,‘0’)},“Invoice Date”.FSCL_MO_NO)}=
({fn substring(to_number(@Prompt(‘Enter Year No/Year and Quarter No/Year and Month No:’,‘A’,Mono,Free)),1,4)}-1)||
{fn substring(to_number(@Prompt(‘Enter Year No/Year and Quarter No/Year and Month No:’,‘A’,Mono,Free)),5,3)}
This code works for only 6 or more digits input values.
For Year: 002020
For Quarters: 020201, 020202, 020203, 020204 (concat of year and quarter)
For Months: 202001,202002…2020012 (concat of year+zero+month)
To_number function is used to remove leading zeros.
I have added two queries in report. one query with current period filter and one with prior period filter. Report seems to be working now.
Now My next step is to create a custom lov and map to the input values (fingers crossed, have to see how it works ). so my final prompt should give me (YTD, QTR1, QTR2, QTR3, QTR4, APR, MAY, JUN…MAR) Our fiscal year is from APR to MAR.
Hope this could help someone else.
anil.ganga1
(BOB member since 2007-07-04)