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

Need to distribute Capacity value from starting date to till date

Hi,

I have Plant wise capacity volume with starting date, my task is to distribute the volume using starting date to till date.

 

Example : 

PlantCapacity SOP
AP12500Mar-19
Europe30000Aug-19

 

Need to convert the above table into below pivot table format 

Required :

PlantCapacityMarch 1, 2019Apirl 2019May 1, 2019Jun 1,2019July 1, 2019August 1, 2019Sep 1,2019October 1, 2019November 1, 2019December 1, 2019January 1, 2020February 1, 2020March 1, 2020
AP1250012500125001250012500125001250012500125001250012500125001250012500
Europe30000000003000030000300003000030000300003000030000

 

Thanks in advance 

 

Regards

Sirajahamed S

 

 

2 Replies
Taoufiq_Zarra

attached qvw and qvf version :

 

Data:
LOAD Date(Date#(SOP,'MMM-YY')) as Date,* INLINE [
    Plant, Capacity , SOP
    AP, 12500, Mar-19
    Europe, 30000, Aug-19
];

MinMaxDate:

	Load Min(Date) as MinDate, Makedate(Year(min(Date))+1,Month(min(Date)),1) as MaxDate resident Data;
	Let vMinDate = Peek('MinDate',-1,'MinMaxDate') - 1;
	Let vMaxDate = Peek('MaxDate',-1,'MinMaxDate') ;
	Drop Table MinMaxDate;
	
MasterCalendar:

	Load Date,
	Year(Date) as Year,
	Month(Date) as Month;
	Load Date(recno()+$(vMinDate)) as Date Autogenerate vMaxDate - vMinDate;

Temp:
noconcatenate

load Date(min(Date)) as Date2 resident MasterCalendar group by Year,Month;
drop table MasterCalendar;
join
load * resident Data;

drop table Data;


Result:
noconcatenate

Load Plant,Date(Date2,'MMM-YY') as New_SOP,if(Date2<Date,0,Capacity) as Capacity resident Temp;

drop table Temp;

 

 

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Siraj
Contributor
Contributor
Author

Hi Taoufiq,

Thanks for your reply. Will try this and let you know.

 

Regards

Sirajahamed S