Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

Need to get 2 ages

HI All,

Frank Hartmann

I have the following code:

load

System_Code ,

//   SystemCodeDescription as SCD,

  Country ,

  Market ,

  Equipment ,

      Calendar_Month_Code ,

      Plant ,

      District ,

      [Part Group] ,

      Entitlement ,

      Key_EMS ,

      Install_Flag ,

      Removal_Flag ,

  TechnicalStartDate ,

//   Age2 as AGE2,

  Age_Final ,

  Part_Age_Bucket

Now to get the minimum age i will write this expression

min(Age_Final ) as Age_Final  and do group by. for this i will get one minimum age which is fine.


But i need to get 2 min ages.


Can you please help me.


Thanks,

Bharat

Labels (1)
28 Replies
bharatkishore
Creator III
Creator III
Author

Hi Anil,

Any help pls..

sasiparupudi1
Master III
Master III

May be try like below

Data:

LOAD Equipment,

     [Part Group],

     Key_EMS,

     Calendar,

     Age_Final,

     Quantity

FROM

(ooxml, embedded labels, table is Sheet1);

Left Join(Data)

Load

Equipment,

[Part Group],

Calendar,

Sum(Quantity) as TotalQty

Resident Data

Group By

Equipment,

[Part Group],

Calendar

;

Left Join(Data)

Load

Equipment,

[Part Group],

Calendar,

Min(TotalQty,1) as Min1,

Min(TotalQty,2) as Min2

Resident Data

Group By

Equipment,

[Part Group],

Calendar

;

bharatkishore
Creator III
Creator III
Author

Thanks For your reply.. But not getting the desired output

sasiparupudi1
Master III
Master III

May I know the desired o/p?

bharatkishore
Creator III
Creator III
Author

Output should be in the below format:

EquipmentPart GroupKey_EMSCalendarAge_FinalQuantity
E1P1Key22013-0130
E1P1Key42013-0151
E2P1Key72013-01221
E2P1Key82013-01150
E3P2Key102013-0251
E3P2Key112013-0250

And need to do sum of quantity and  group by should be on following columns i.e Equipment,Part Group,Calendar

sasiparupudi1
Master III
Master III

Try

Data:

LOAD Equipment,

     [Part Group],

     Key_EMS,

     Calendar,

     Age_Final,

     Quantity

FROM

(ooxml, embedded labels, table is Sheet1);

MinData:

Load

Equipment,

[Part Group],

Calendar,

Min(Age_Final,1) as Age_Final

Resident Data

Group By

Equipment,

[Part Group],

Calendar

;

concatenate( MinData)

Load

Equipment,

[Part Group],

Calendar,

Min(Age_Final,2) as Age_Final

Resident Data

Group By

Equipment,

[Part Group],

Calendar

Left Join(MinData)

LOAD Equipment,

     [Part Group],

     Key_EMS,

     Calendar,

     Age_Final,

     Quantity

Resident Data;

Drop Table Data;

bharatkishore
Creator III
Creator III
Author

Thank you so much for your time and reply. Only thing i need to get is that please find the below image:

T.PNG

Here for equipment E3 i am getting 3 age final.. where only i need to get 2 ages. which means it should be

      

E3P2Key102013-0251
E3P2Key112013-0250

If this is done then hopefully it will be done. Kindly help.

Please let me know if you need anything more.

bharatkishore
Creator III
Creator III
Author

HI Sasidhar,

Any suggestion pls..

bharatkishore
Creator III
Creator III
Author

vamsee99999‌  can you please have a look and help..

vamsee
Specialist
Specialist

Can you please share your final QVW after the progress you've achieved with the above suggestions.