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: 
Anonymous
Not applicable

Peek () and Previous()

Hi All,

1. using Peek and Previous

a. generate the data <date,rain(yes/no)> for each day of 2015 such

that there are at least 80% days that are rainy.

  01/01/2015 yes

the line above means that it rained on Jan 01,2015.

b. based on this data, for everyday calculate the consecutive number

of days it rained

c. finally create a table with maxdate, maxrun fields that contains

the date when the longest consecutive spell of rain ended, and the

number of consecutive days that it rained.


can you please help on this?

9 Replies
Anil_Babu_Samineni

Can you explain more, i didn't get your concern? Please post sample application with expected o/p which demonstrates the issue?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Hi Anil,

by using auto generate we have to create the data in the script itself.

Anil_Babu_Samineni

Yes, We can. Check this if helpful

LOAD Date(MinDate+IterNo()-1) as Date 

While MinDate+IterNo()-1 <= MaxDate; 

LOAD MakeDate(2014) as MinDate, 

     Today() as MaxDate

AutoGenerate 1;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Would you be able to provide a sample of few rows of data with your expected output to help you better here

ToniKautto
Employee
Employee

It is unclear how Peek() and Previous() are related to your question. Please elaborate, and consider providing additional information.

  1. Describe the data you are loading. For example attach a sample text file or xls file.
  2. Describe the expected output. For example manually populate filed values in a excel file to demonostarte you expected output.
  3. Describe how you have tried to resolve the scenario. Attach a QVW file to make it easier to evaluate your approach and problem.
Anonymous
Not applicable
Author

Please have a look

   

DateRainStatus
1/1/2015Yes
1/2/2015No
1/3/2015No
1/4/2015Yes
1/5/2015Yes
1/6/2015Yes80%
1/7/2015Yes
1/8/2015Yes
1/9/2015Yes
1/10/2015YesSo I need 80 % of rainy days
1/11/2015Yes
1/12/2015Yes
sunny_talwar

Why can't you just do this on a front end text box object:

Count({<RainStatus = {'Yes'}>}RainStatus)/Count(RainStatus)

Anonymous
Not applicable
Author

that just for assumption for understanding the requirement i showed you date, rainstatus

with out any source can we create date and rain status fields  by using auto generate  or some other funtion

if you look at the qvw i created Date field like that

ToniKautto
Employee
Employee

Please see attached on how to aggregate 83% rainy days for January.