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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create flags to count Unique

Hi,

Very new to QV.  My data is order numbers with multiple events.  I'm trying to flag when an order has both an 2 and 4 event.

Order       Event

123456     6

123456     2

123456     9

123456     4

If order number 123456 has both a 2 and 4 event create flag 1 else 0.

Not able to get it to work, only able to identify if it has one or the other.  Any help is very much appreciated.

2 Replies
Miguel_Angel_Baeyens

Hi Kerri,

Using Peek() and Previous() function should work. See sample codes in

Accumulation in Script

Cumulative calculation at script level

Counting the number of times a word appears at the detail level

Miguel

maxgro
MVP
MVP

source:

load * inline [

Order  ,     Event

123456 ,    6

123456 ,    2

123456 ,    9

123456 ,    4

1,2

1,3

2,4

2,5

3,6

3,7

3,8

];

Left join (source)

load Order, if(count(Event)=2,1) as cnt

resident source

where match(Event, 2,4)

group by Order;