Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Qlik Experts,
Please refer the data which I have attached 'Input_Output File.xlsx'.
Example:
This is my input data.
product_brand_name | product_name | product_ndc | date_year_month | Sum of effective_wac_price |
Vac2387 | 200MG/10ML | 13601 | 2017-01 | 934.440857 |
Vac2387 | 200MG/10ML | 13601 | 2017-02 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-04 | 1011 |
Vac2387 | 200MG/10ML | 13601 | 2017-05 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-06 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-07 | 981.127746 |
Vac2387 | 200MG/10ML | 13601 | 2017-10 | 994.28 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-01 | 50 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-02 | 51 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-06 | 52 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-08 | 53 |
Expected Output:
product_brand_name | product_name | product_ndc | date_year_month | Sum of effective_wac_price |
Vac2387 | 200MG/10ML | 13601 | 2017-01 | 934.440857 |
Vac2387 | 200MG/10ML | 13601 | 2017-02 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-03 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-04 | 1011 |
Vac2387 | 200MG/10ML | 13601 | 2017-05 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-06 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-07 | 981.127746 |
Vac2387 | 200MG/10ML | 13601 | 2017-08 | 981.127746 |
Vac2387 | 200MG/10ML | 13601 | 2017-09 | 981.127746 |
Vac2387 | 200MG/10ML | 13601 | 2017-10 | 994.28 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-01 | 50 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-02 | 51 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-03 | 51 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-04 | 51 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-05 | 51 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-06 | 52 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-07 | 52 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-08 | 53 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-09 | 53 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-10 | 53 |
Please provide me the solution in Qlik.
I have tried firstly Master calendar , secondly used peek function. Im provide the script here as well.
Please provide me the script for the output. Its very challenging for me to get the output.
I need your help guys.
Thanks in Advance Heartfully.
Hi,
You can try this :
Regards,
SRA
Hi
I have adjusted the script for the new requirement to take into account the products that didn't start on 2017-01.
However, I have a question, in your excel the required output for Vac_8989 doesn't have 2017-10. Should it be like this or should this line also be included?
I mean, with the script below the 2017-10 is included since I assumed it should be there like the other products and because then the modification is minimum. Removing it will be a bit trickier. So, let me know.
Hi,
You can try this :
Regards,
SRA
Hi
I have found this solution too:
Hi Daniel,
Thanks its really helpful. Its giving the expected output.
But there is a case, in my input excel file if you see, both product_brand_name have the same date_year_month start. (That is product_brand_name of Vac2387 and Vac_5590 have 2017-01 is the start date).
but my 3rd product_brand_name Vac_8989 have the start date of 2017-05. but When I ran your code, Im getting values populated on 2017-01 to 2017-04 for this product which is picking values from previous product_brand_name. But I expect the start date of this product_brand_name to be from 2017-05 only. (Please refer my input and expected output table below)
Input:
product_brand_name | product_name | product_ndc | date_year_month | Sum of effective_wac_price |
Vac2387 | 200MG/10ML | 13601 | 2017-01 | 934.440857 |
Vac2387 | 200MG/10ML | 13601 | 2017-02 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-04 | 1011 |
Vac2387 | 200MG/10ML | 13601 | 2017-05 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-06 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-07 | 981.127746 |
Vac2387 | 200MG/10ML | 13601 | 2017-10 | 994.28 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-01 | 50 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-02 | 51 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-06 | 52 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-08 | 53 |
Vac_8989 | 300MG/50ML | 15666 | 2017-05 | 70 |
Vac_8989 | 300MG/50ML | 15666 | 2017-09 | 80 |
Expected Output:
product_brand_name | product_name | product_ndc | date_year_month | Sum of effective_wac_price |
Vac2387 | 200MG/10ML | 13601 | 2017-01 | 934.440857 |
Vac2387 | 200MG/10ML | 13601 | 2017-02 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-03 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-04 | 1011 |
Vac2387 | 200MG/10ML | 13601 | 2017-05 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-06 | 948.73 |
Vac2387 | 200MG/10ML | 13601 | 2017-07 | 981.127746 |
Vac2387 | 200MG/10ML | 13601 | 2017-08 | 981.127746 |
Vac2387 | 200MG/10ML | 13601 | 2017-09 | 981.127746 |
Vac2387 | 200MG/10ML | 13601 | 2017-10 | 994.28 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-01 | 50 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-02 | 51 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-03 | 51 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-04 | 51 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-05 | 51 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-06 | 52 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-07 | 52 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-08 | 53 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-09 | 53 |
Vac_5590 | VIAL WET SD,200MG/10ML | 13602 | 2017-10 | 53 |
Vac_8989 | 300MG/50ML | 15666 | 2017-05 | 70 |
Vac_8989 | 300MG/50ML | 15666 | 2017-06 | 70 |
Vac_8989 | 300MG/50ML | 15666 | 2017-07 | 70 |
Vac_8989 | 300MG/50ML | 15666 | 2017-08 | 70 |
Vac_8989 | 300MG/50ML | 15666 | 2017-09 |
80
|
Hi Daniel,
Thanks for your code. It was really helpful.
The edge case I'm having is,
Assume 'Vac_8989' (from product_brand_name column) product newly coming from the start date of '2017-05' (from date_year_month column). Since we have a minimum date of data is '2017-01', the code which you have provided, is populating values for 2017-01 to 2017-04(means its picking previous product_brand_name values).
Please refer the attached file which has my
1. New input in 'Input' sheet
2. Current Output in 'Current Output' sheet
3. Expected output in 'Required Output'
please provide me code for my requirements.
Thanks in advance
Hi
I have adjusted the script for the new requirement to take into account the products that didn't start on 2017-01.
However, I have a question, in your excel the required output for Vac_8989 doesn't have 2017-10. Should it be like this or should this line also be included?
I mean, with the script below the 2017-10 is included since I assumed it should be there like the other products and because then the modification is minimum. Removing it will be a bit trickier. So, let me know.