Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ghassanaldalati
Contributor III
Contributor III

New Customer and Dead Customer between Max Year and previous Years

Hi All... Please help me.

I am create ListBox for New Customer have sales in max selected Years and have no Sales in previous Years from Years selected Rang

if I select Year 2014 - 2015 - 2016 - 2017 and I want to show only the new 2017 customer with sales amount

" =if(sum({$<Year={"$(=max(Year))"}>}Sales)=0 and sum(Sales)>0  then show me the new customers with sales amount "

also I need to create another customer list for dead costumes have sales in previous years and have no sales in max year

please help me how to use IF statement in my expression .

Thank;s and regards

1 Solution

Accepted Solutions
sunny_talwar

Did you try my expression? Seems to be working

New Customers

=Aggr(If(Sum({<Year -= {'$(=Min(Year))'}>} Sales) > 0 and Sum({<Year = {'$(=Min(Year))'}>} Sales) = 0, CustName), CustName)

Dead Customers

=Aggr(If(Sum({<Year = {'$(=Max(Year))'}>} Sales) = 0 and Sum({<Year -= {'$(=Max(Year))'}>} Sales) > 0, CustName), CustName)

Capture.PNG

View solution in original post

22 Replies
arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi Ghasssan,

Please create flag on script level and use it on front end.

Load

.

.

If(year = '2017'   and Amount >0) as Flag,

From

<Path>



Thanks,

Arvind Patil

Anonymous
Not applicable

Hi ,

Can you please provide any sample data.

ghassanaldalati
Contributor III
Contributor III
Author

Sorry Dear but what I am asking for is to create ListBox for New Customer and Dead Customers in

arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi Ghassan,

Please do as below:

Load

.

.

If(year = '2017'   and Amount >0,Customer) as [New  Customer],

From

<Path>



Thanks,

Arvin Patil

sunny_talwar

May be this

New Customer

Aggr(If(Sum({<Year = {'$(=Max(Year))'}>} Sales) > 0 and Sum({<Year -= {'$(=Max(Year))'}>} Sales) = 0, Customer, Customer)


Dead Customer

Aggr(If(Sum({<Year = {'$(=Max(Year))'}>} Sales) = 0 and Sum({<Year -= {'$(=Max(Year))'}>} Sales) > 0, Customer, Customer)

pradosh_thakur
Master II
Master II

correct me if i am wrong here sunny but should not be the expression be  like this cause it is to create a list box

New Customer

If(aggr(Sum({<Year = {'$(=Max(Year))'}>} Sales) ,Customer)> 0 and aggr(Sum({<Year -= {'$(=Max(Year))'}>} Sales),Customer) = 0, Customer,null())


Learning never stops.
sunny_talwar

What is the issue with an overarching Aggr()? I mean if you wish to repeat is twice, sure.. but not sure why

ghassanaldalati
Contributor III
Contributor III
Author

Thank you for help..... But sorry not working

I try to attache example file but I don.t find attachment buttom

for that I mak new post with attachment

http://community.qlik.com/message/1358884#1358884

New Customer and Dead Customer between Max Year and previous Years

plese Help me.......

thanks and regards

pradosh_thakur
Master II
Master II

Use advance editor... You will have attach option at the right bottom..

Learning never stops.