Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
tka_ovako
Contributor II
Contributor II

Getting data from every phase

Hello.

I need to get value from varius phase from our production. Now I can get values from min phase and max phase but how I get values from every phase number. That value is FinalTons. This should do in script.

   

   

ProductionWeekProductionDayWorkCenterSKeyPhaseNoEventEndDateFinalTonsScrapTonsEventStartDate
2017242017-06-17 13:18:17.000104102017-06-17 19:19:42.0004,79NULL2017-06-17 19:18:17.000
2017242017-06-18 10:52:28.000145202017-06-19 15:33:50.0004,79NULL2017-06-18 16:52:28.000
NULLNULL10423NULL8,224NULLNULL
NULLNULL14524NULL8,224NULLNULL
NULLNULL10425NULL8,224NULLNULL
2017252017-06-20 11:32:40.000104262017-06-20 17:32:47.0003,445NULL2017-06-20 17:32:40.000
2017252017-06-20 21:37:25.000145272017-06-22 03:36:31.0003,445NULL2017-06-21 03:37:25.000
2017262017-06-26 16:37:36.000104282017-06-26 22:39:07.0003,445NULL2017-06-26 22:37:36.000
2017252017-06-20 05:59:23.000104302017-06-20 11:59:32.0004,79NULL2017-06-20 11:59:23.000
2017252017-06-20 07:24:17.000110402017-06-20 13:39:37.0002,395NULL2017-06-20 13:24:17.000
2017252017-06-20 07:24:17.000110402017-06-27 01:02:33.0005,84NULL2017-06-20 13:24:17.000
2017262017-06-26 19:02:33.00010050NULLNULLNULLNULL
2017262017-06-28 01:32:31.000130602017-06-28 07:32:31.0008,2240,0112017-06-28 07:32:31.000
2017262017-06-29 03:12:50.00014770NULL8,224NULLNULL

Now my script for min phaseNo is

left join (Production)
LOAD
ProductionOrderLine,
min(PhaseNo) as PhaseNo,
1
as PhaseNo_min
Resident Production
group by ProductionOrderLine;

I also have another question:

When I have two or more same WorkCenterSKey (for example 104) how I can sort them with smallest phaseNo? I mean that I need to find smallest phaseno that individual WorkCenterSKey get (for example 104) .

BR.

Timo

1 Solution

Accepted Solutions
avkeep01
Partner - Specialist
Partner - Specialist

Hi Timo,

You could try adding Phase as a dimension in your script. Then you also need to add this in de group by part. But then there is no function used in the load. So I added SUM(1).

left join (Production)
LOAD
ProductionOrderLine,
PhaseNo as PhaseNo,
SUM(1)
as PhaseNo_min
Resident Production
group by ProductionOrderLine, PhaseNo;


For the second part:

left join (Production)
LOAD
WorkCenterSKey,
MIN(PhaseNo) as MIN_PhaseNo,
Resident Production
group by WorkCenterSKey;

View solution in original post

1 Reply
avkeep01
Partner - Specialist
Partner - Specialist

Hi Timo,

You could try adding Phase as a dimension in your script. Then you also need to add this in de group by part. But then there is no function used in the load. So I added SUM(1).

left join (Production)
LOAD
ProductionOrderLine,
PhaseNo as PhaseNo,
SUM(1)
as PhaseNo_min
Resident Production
group by ProductionOrderLine, PhaseNo;


For the second part:

left join (Production)
LOAD
WorkCenterSKey,
MIN(PhaseNo) as MIN_PhaseNo,
Resident Production
group by WorkCenterSKey;