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

Script Solution for consolidate the data with logic

Hi Team,

I have a scenenrio, Like This --> In a table I have 2 country data with different ID, Month, LOB and Numerator (Value). Now I have to consolidate the data through script.

Sri Lanka Data + Maladive Data

1. If ID = KPI 18 and Month_Year = 201806 and Country = Sri Lanka and LOB = XLOB and Numerator = 1

and If ID = KPI 18 and Month_Year = 201806 and Country = Maldives and LOB = XLOB and Numerator = PD

Then Output =

ID = KPI 18 and Month_Years = 201806 and Country - Sri Lanka & Maldives and LOB = XLOB and Numerator = 1

2. If ID = KPI 18 and Month_Year = 201806 and Country = Sri Lanka and LOB = XLOB and Numerator = PD

and If ID = KPI 18 and Month_Year = 201806 and Country = Maldives and LOB = XLOB and Numerator = PD

Then Output =

ID = KPI 18 and Month_Years = 201806 and Country - Sri Lanka & Maldives and LOB = XLOB and Numerator = PD

3. If ID = KPI 18 and Month_Year = 201806 and Country = Sri Lanka and LOB = XLOB and Numerator = PD

and If ID = KPI 18 and Month_Year = 201806 and Country = Maldives and LOB = XLOB and Numerator = ND

Then Output =

ID = KPI 18 and Month_Years = 201806 and Country - Sri Lanka & Maldives and LOB = XLOB and Numerator = ND

For more ref. Please find the attached xls.

Please look into this and help me to solve the same.

I have kept in 2 ID, Suppose if it works for 18 and tomorrow if requirement change by ID, Like KPI 18 to KPI 21 then in this scenario what to do, I have to change by code by code or any other solution is there.

Regards,

AS

6 Replies
Shubham_Deshmukh
Specialist
Specialist

Hi AKumar,
Please share sample output, your given and output looking same so seems confusing.
Regards
sona_sa
Creator II
Creator II
Author

Hi,
Output is not same. Just check output is for country it is merge for srinlanka and Maldives and numerator value is change.
sona_sa
Creator II
Creator II
Author

Hi Bro,

Hope this XLS will help you. Data sheet is all comination of data input and output. Sri Lanka Sheet have Sri Lanka Data. Maldives have Maldives data and in Output Sheet  there is Output and it is consolidation of both Sri Lanka and Maldives on the logic, what I have defined earlier. ND and PD  and Value base.

sona_sa
Creator II
Creator II
Author

Hope this XLS will help you. Data sheet is all comination of data input and output. Sri Lanka Sheet have Sri Lanka Data. Maldives have Maldives data and in Output Sheet  there is Output and it is consolidation of both Sri Lanka and Maldives on the logic, what I have defined earlier. ND and PD  and Value base.

Shubham_Deshmukh
Specialist
Specialist

Basically, you are getting whatever result you want right?
But in future in KPI18 changes to KPI21 then what to do instead of doing change in code, is that your issue?
sona_sa
Creator II
Creator II
Author

Yes that is also, But first, I have to consolidate the data for 18 and then I have to work on 21.

If you are working on same, Please send me code, do not attach any thing, I can not download. Only I can copy the code.

Regards,

AS