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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
aj0031724
Partner - Creator
Partner - Creator

Apply logic as expression in Straight table without Peek and Previous

Hi,

I am trying to modify the below script to use in Straight Table AS EXPRESSION  but not getting an idea how Can I apply  the same logic without Peek and Previous as these are not working in Straight Table :

if(Previous(Value)>4 and Value>4,PROFIT,
if(-rangesum((Value>4),(peek(Value,-1)>4),(peek(Value,-2)>4),(peek(Value,-3)>4),(peek(Value,-4)>4),(peek(Value,-5)>4),(peek(Value,-6)>4))>=4,'Highly PROFIT,
if(-rangesum((Value<3),(peek(Value,-1)<3),(peek(Value,-2)<3),(peek(Value,-3)<3),(peek(Value,-4)<3),(peek(Value,-5)<3),(peek(Value,-6)<3))>=6,'Low PROFIT',
'LOSS'')))  as
CLASSES.

I AM USING DATE   AS DIMENSION.

THE REQUIREMNT IS TO MARK EACH DATE WITH CLASSIFICATION AS ABOVE DOING 7 DAYS SLIDING WINODWS CALCULATION.

The 7 day logic means a cell is classified according to if in the last 7 days the classification logic comes out TRUE. So for each day you must look at the 6 days previous to the day + the day considered (total of 7 days) and then do the logic and decide which classification is TRUE for that day.

Can you please advice/suggest the workaround.

12 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

My suggestion was to post a qvw file with representative data and the objects which you want to populate, as well as the expected output for these objects...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
aj0031724
Partner - Creator
Partner - Creator
Author

Dear Jonathan,

PFA the qvw with data ,variables and formulas  and the expected output.

aj0031724
Partner - Creator
Partner - Creator
Author

Team,

Can you please advice  as per the qvw attached?