Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
joshrussin
Creator III
Creator III

Using Peek

Question for using peek.

My data is already sorted by date, latest date is at the bottom.

I am trying to load an equation with peek().

(latest wip - (next to last wip - latest processed))

Here is what I have in my script and is coming up with different values.

(WIP - ((Peek(WIP,-1)) - Processed)) as WIP_Test

any tips or other methods?

Edit*

also tried Previous()

(WIP - ((Previous(WIP)) - Processed)) as WIP_Test

That doesn't work either.

18 Replies
vvira1316
Specialist II
Specialist II

Hi Joshua,

What is your expected output? How Area, Program, and Date Should be grouped?


BR,

Vijay

joshrussin
Creator III
Creator III
Author

I am trying to get an average WIP inbound per client for the last 30 days. The table following this is showing the clients in Mechanical Inspection for the last 30 days and a total.

KPI_0054.jpg

I am also trying to get a current month daily inbound line graph as follows

KPI_0055.jpg

I am just trying to figure out how to create the "WIP Inbound" column in Qlik rather than computing it in excel first.

vishsaggi
Champion III
Champion III

Check this? Let me know if this is not what you looking for.

I created two variable for Max and Previous max of WIP.

Like

vWIP = Max(WIP)        - --> Max of WIP

vWIP2nd = Max(WIP, 2) ---> 2nd Max of WIP

Expression will be like.

WipTesting:

Load

         WIP,

         $(=vWIP) - ($(=vWIP2) - Processed) as WIP_Test

Resident WIP_Raw_Data

;

joshrussin
Creator III
Creator III
Author

The Avg(WIP_Test) should be the same as the "Average Inbound" that is already the third column in the sheet.

vishsaggi
Champion III
Champion III

Sorry can you explain a little. Why they both should be? Can you take one example and let me know for that specific Client name what should be your value for WIP_Test field. ?

Can you explain the expr you are trying to use for WIP_Test please?

joshrussin
Creator III
Creator III
Author

If you look at the raw data file itself, there is only one row per client per day.

KPI_0056.jpg

If you look at the output from the file you provided, there are multiple for each day instead of each day.

KPI_0057.jpg

So that would throw off the average.

vvira1316
Specialist II
Specialist II

Hi Joshua,

I got you PrevWIP for each record. I've small error that I'm trying to find and fix it. Let me know if this will work for you.

WIP1.JPG

WIP2.JPG

PrevWIP2.JPG

PrevWIP3.JPG

PrevWIP1.JPG

The error is that for some reason in table I got only 12326 records even though processing was for all records. I'm looking into it.

I think there are duplicates. that is causing the difference in record count from original.

joshrussin
Creator III
Creator III
Author

I think this should work, I will look at it in a little while, few things to catch up on here, but after looking at your pics closer, the WIP Inbound is correct. Thanks man.

vvira1316
Specialist II
Specialist II

Hi Joshua,

Script processing may not be needed if we can come up with set analysis expression for Min Date record of each Area, Program combination. For that records we can ignore PrevWIP in WIPInbound calculation. Otherwise we have to use it. This is after PrevWIP value has been added in the table. This will allow to drop FOR LOOP processing that I've in the script. FOR LOOP slows down little bit.

I hope what I'm saying here makes sense and hope it will work.

BR,

Vijay