Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ruma_barman
Creator
Creator

Dynamically create a field on the basis of two dates

Hi All,

Please help me in getting the logic in QlikSense . FrontEnd or Backend either will do.

I have to create a field viz. RepoStatus having two values 'InStock' and 'Sold' .These two values should be on the basis of dates.

Input :

ContractRepo Date Sold Date
A121-01-202128-03-2021
A201-02-202105-08-2021
A312-04-202128-04-2021
A423-04-2021 
A506-06-202128-05-2021
A617-07-202128-06-2021
A728-08-202128-08-2021
A805-09-2021 

Now I have to count the number of YTD contracts on the RepoStatus logic as below:
If a month is selected and the contract repodate is less or equal to the month and
1)Sold Date is blank or greater than the month selected it will be considered as InStock
2)Sold Date is less or equal to the month selected it will be considered as Sold

Output:

If Jan2021 is selected ,

 Count 
InStock1(A1)
Sold0 

If Feb2021 is selected ,

 Count 
InStock2(A1,A2)
Sold0 

If Mar2021 is selected ,

 Count 
InStock1(A2)
Sold1(A1)

 

If Apr2021 is selected ,

 Count 
InStock2(A2,A4)
Sold2(A1,A3)

 

P.S:The contracts in brackets are given for reference,not required in the table

Thanks and Regards,

Ruma

0 Replies