Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rendiyan
Partner - Creator
Partner - Creator

[ASK] Set Analysis count with date range

Dear All,

I need to calculate total remaining unit based on its aging.

Aging is total of days between Stock_In and Stock_Out for History model, and provided by user for Sold model.

I have a fact table that contain Stock History and Stock Sold, with details :

TransTableModelSold_DateStock_InStock_OutBranchAging
HistoryA101/09/201030/10/2010159
HistoryA101/11/201030/12/2010259
HistoryA201/11/201030/12/2010259
HistoryA310/11/201030/12/2010350
SoldA114/11/2010214

Based on above sample, i use Sold Date as Date Dimension.

User requirment is confusing me, which is need to see remaining stock based on branch and aging.

So the result will be like sample below :

Year Selection : 2010

Month Selection : 11

BranchAgingRemaining Stock
2591
3501

Is there any solution for above issue with set analysis?

There's 1 requirement to count remaining stock based on selected sold month and year, with Branch as a dimension, and i able to show it with below set analysis.

(     //count total model based on period of sold model

count(DISTINCT

{<TransTable={'History'}

,Year=, Month=

,Stock_In={'<=$(=max({<TableType={'Sold'}>}Sold_Date))'},Stock_Out={'>=$(=max({<TableType={'Sold'}>}Sold_Date))'}

>}

Model)

)

-

(     //count total sold model

count(DISTINCT

{<TransTable={'Sold'}

,Year=, Month=

,Sold_Date={'<=$(=max({<TableType={'Sold'}>}Sold_Date))'}

>}

Model)

)

Many thanks,

Best Regards

0 Replies