Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Fulgurr
Contributor
Contributor

Stock calculation

Hi everybody !

I use Qliksense since this year, and i like this software, but i encounter difficulties. 

I want to count my contract stock, month per month, but its difficult...

I have a database which contains contract with 2 dates : 

Examples :

contract   effect               end

100             21/06/2020    25/12/2020

101              15/10/2020    30/03/2021

...

 

I count my stock month per month as follow :

count({<year=, month=, effect={"<=$(=Date(max([ActifDate])))"},end={">$(=Date(max([ActifDate])))"}>} distinct contract)

 

with : 

Year(%Date) as year

Month(%Date) as month

if(num(%Date)<num(Today()), %Date) as ActifDate

The principle is simple: I count contract references, which must have 2 dates that meet the conditions in the count. I want this calculation for each month end of the year.

The problem is that it tells me the number of contracts per month corresponding to the definition, but broken down by month and year, instead of calculating me this number on the given date. I don't know how to tell the difference?

I don't know if i am clear ?

Thanks to your help !

 

Labels (2)
2 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

For that you need to generate those data points for each month.

Below function will help you do that.

https://help.qlik.com/en-US/sense/August2022/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPrefix....

 

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
abhijith28
Creator II
Creator II

can you share the sample input & expected output