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

Need help to - Get Percentage reached date based on cumulative sum

Dear Qlikers,

I am getting the below source data,

Name Delivery Name Order Qty Received Qty Received Date
USA 2022-oct 6500 6300 09-04-2022
USA 2022-oct 6200 5100 09-05-2022
USA 2022-oct 7500 6000 09-06-2022
USA 2022-oct 5000 4000 09-07-2022
USA 2022-oct 6200 5900 09-08-2022
USA 2022-oct 5000 1000 09-09-2022
USA 2022-oct 5000 500 09-10-2022
USA 2022-oct 6500 500 09-11-2022
USA 2022-oct 7000 300 09-12-2022
USA 2022-oct 6500 6000 09-01-2023
USA 2022-oct 6000 6000 09-02-2023
USA 2022-oct 2000 2000 09-03-2023
USA 2022-oct 6000 5500 09-04-2023
USA 2022-oct 7500 7000 09-05-2023
USA 2022-nov 6500 6300 10-04-2022
USA 2022-nov 6200 5100 10-05-2022
USA 2022-nov 7500 6000 10-06-2022
USA 2022-nov 5000 4000 10-07-2022
USA 2022-nov 6200 5900 10-08-2022
USA 2022-nov 5000 4500 10-09-2022
USA 2022-nov 5000 4500 10-10-2022
USA 2022-nov 6500 6000 10-11-2022
USA 2022-nov 7000 6500 10-12-2022
USA 2022-nov 6500 6000 10-01-2023
USA 2022-nov 6000 6000 10-02-2023
USA 2022-nov 2000 2000 10-03-2023

 

and i need to show the below output

Name Delivery Name Order Qty Received Qty Received Date Total order Qty CU Rec qty Percentage  
USA 2022-oct 6500 6300 09-04-2022 82900 6300 8%  
USA 2022-oct 6200 5100 09-05-2022 82900 11400 14%  
USA 2022-oct 7500 6000 09-06-2022 82900 17400 21%  
USA 2022-oct 5000 4000 09-07-2022 82900 21400 26%  
USA 2022-oct 6200 5900 09-08-2022 82900 27300 33% 09-08-2022
USA 2022-oct 5000 1000 09-09-2022 82900 28300 34%  
USA 2022-oct 5000 500 09-10-2022 82900 28800 35%  
USA 2022-oct 6500 500 09-11-2022 82900 29300 35%  
USA 2022-oct 7000 300 09-12-2022 82900 29600 36%  
USA 2022-oct 6500 6000 09-01-2023 82900 35600 43%  
USA 2022-oct 6000 6000 09-02-2023 82900 41600 50% 09-02-2023
USA 2022-oct 2000 2000 09-03-2023 82900 43600 53%  
USA 2022-oct 6000 5500 09-04-2023 82900 49100 59%  
USA 2022-oct 7500 7000 09-05-2023 82900 56100 68%  
USA 2022-nov 6500 6300 10-04-2022 69400 6300 9%  
USA 2022-nov 6200 5100 10-05-2022 69400 11400 16%  
USA 2022-nov 7500 6000 10-06-2022 69400 17400 25%  
USA 2022-nov 5000 4000 10-07-2022 69400 21400 31% 10-07-2022
USA 2022-nov 6200 5900 10-08-2022 69400 27300 39%  
USA 2022-nov 5000 4500 10-09-2022 69400 31800 46%  
USA 2022-nov 5000 4500 10-10-2022 69400 36300 52%  
USA 2022-nov 6500 6000 10-11-2022 69400 42300 61% 10-11-2022
USA 2022-nov 7000 6500 10-12-2022 69400 48800 70%  
USA 2022-nov 6500 6000 10-01-2023 69400 54800 79%  
USA 2022-nov 6000 6000 10-02-2023 69400 60800 88%  
USA 2022-nov 2000 2000 10-03-2023 69400 62800 90% 10-03-2023

 

Final Out put is

Name Delivery Name Order Qty Received Qty 30 % Reached  50 % Reached  90 % Reached
USA 2022-oct 82900 56100 09-08-2022 09-02-2023 -
USA 2022-nov 69400 62800 10-07-2022 10-10-2022 10-03-2023

 

Sunny Talwar ‌@stalwar1

 

Thanks in advance


-Somasundaram

If this resolves your Query please like and accept this as an answer.
Labels (6)
1 Solution

Accepted Solutions
Kushal_Chawda

@Somasundaram  script solution is below

Data:
LOAD
    Name,
    "Delivery Name",
    "Order Qty",
    "Received Qty",
    "Received Date"
FROM Source;

Left Join(Data)
Load Name,
    "Delivery Name",
    sum("Order Qty") as Total_Order_Qty
Resident Data
Group by Name,
    "Delivery Name";
    
Final:
Load *,
    RowNo() as Key,
    dual(round(Accum_Received_Qty/Total_Order_Qty *100)&'%',round(Accum_Received_Qty/Total_Order_Qty *100)) as %reached;
Load *,
    if(Name<>Previous(Name) or "Delivery Name" <> Previous("Delivery Name"),
    "Received Qty", RangeSum(Peek('Accum_Received_Qty'),"Received Qty")) as Accum_Received_Qty
Resident Data
Order by Name,"Delivery Name","Received Date";

Drop Table Data;

 

Now create a table on front end like below

Dimension: Name, [Delivery Name]

Measure :

30% Reached

=min({<Key={"=[%reached]>=30"}>}[Received Date])

50% Reached

=min({<Key={"=[%reached]>=50"}>}[Received Date])

 

View solution in original post

3 Replies
Kushal_Chawda

@Somasundaram  do you prefer frond end or script solution? 

Kushal_Chawda

@Somasundaram  script solution is below

Data:
LOAD
    Name,
    "Delivery Name",
    "Order Qty",
    "Received Qty",
    "Received Date"
FROM Source;

Left Join(Data)
Load Name,
    "Delivery Name",
    sum("Order Qty") as Total_Order_Qty
Resident Data
Group by Name,
    "Delivery Name";
    
Final:
Load *,
    RowNo() as Key,
    dual(round(Accum_Received_Qty/Total_Order_Qty *100)&'%',round(Accum_Received_Qty/Total_Order_Qty *100)) as %reached;
Load *,
    if(Name<>Previous(Name) or "Delivery Name" <> Previous("Delivery Name"),
    "Received Qty", RangeSum(Peek('Accum_Received_Qty'),"Received Qty")) as Accum_Received_Qty
Resident Data
Order by Name,"Delivery Name","Received Date";

Drop Table Data;

 

Now create a table on front end like below

Dimension: Name, [Delivery Name]

Measure :

30% Reached

=min({<Key={"=[%reached]>=30"}>}[Received Date])

50% Reached

=min({<Key={"=[%reached]>=50"}>}[Received Date])

 

Somasundaram
Creator III
Creator III
Author

@Kushal_Chawda  Thank you so much


-Somasundaram

If this resolves your Query please like and accept this as an answer.