Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to tag Orders with YES/NO if customer name is same?

Hi Guys,

I have requirement where I would like to tag the Order as dual Order if the following condition is matched


Condition :

If a Customer placing Order from same Store more then once on the same date then that order should be tagged as dual order.

As an example:

in below table, only Order ID 1 & 2 should be tagged as a Dual Order Because Order ID 3 has different order date.

OrderIDCustomer NameProduct NameStore NameOrder Date
1Jon SnowBreadCity Store15/06/2016
2Jon SnowMilkCity Store15/06/2016
3Jon SnowSugarEastern Store16/06/2016

What I am trying to Achieve:

I want to create a Straight table in QlikView which will have dimensions like (Customer Name, City, DOB, Product, Order Date etc..)

And I want to have an extra column 'Dual Product' and it should be YES or NO like below:


OrderIDCustomer NameProduct NameStore NameOrder DateDual Product?
1Jon SnowBreadCity Store15/06/2016Yes
2Jon SnowMilkCity Store15/06/2016Yes
3Jon SnowSugarEastern Store16/06/2016No

My Data Model is like This.. (QVW Attached)

Schema.png

Hope it makes sense.

Thank you

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

In Expression

If(Count(TOTAL <Name,OrderDate,StoreName> OrderId) > 1,'YES','NO')

View solution in original post

12 Replies
bindu_apte
Creator III
Creator III

Hi,

Can you please provide qvw file

Not applicable
Author

Hi bindu.apte‌ Thank you for taking time. I have now attached QVW.

antoniotiman
Master III
Master III

Try like this (Expression)

If(Count(TOTAL <CustomerId,OrderDate,StoreName> OrderId) > 1,'YES','NO')

muthukumar77
Partner - Creator III
Partner - Creator III

Hi,

I hope this sample app will be useful for you.

PFA

Muthukumar Pandiyan
Not applicable
Author

Thank you Muthukumar,

I forgot to mention that every order creates a new customer ID so what should be the load script in that case?

Thanks

Not applicable
Author

Hi Antonio, Thank you for your reply but using your expression it shows me all the order placed by Jon Snow as YES

Pivot.png

Only Order ID 1 & 2 should be YES because Order Id 3 has different date then 1&2

antoniotiman
Master III
Master III

In Expression

If(Count(TOTAL <Name,OrderDate,StoreName> OrderId) > 1,'YES','NO')

muthukumar77
Partner - Creator III
Partner - Creator III

Sorry, I'm not understood. Can you send me actual output?

Muthukumar Pandiyan
Not applicable
Author

Hi Muthukumar,

Your solution is only tagging Order ID 1,2 & 6 like below

Pivot 2.png

But Order ID 3, 4, 5 should also display value as 'NO'

Also note that every order creates a new customer entry so the customer name Jon Snow will have 3 entries in the customer table. (I have attached the QVW with updated customer table in load script)