Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
lostSquirrel112
Contributor II
Contributor II

Flagging and retrieving first instance

Assuming the following data set...

Fact:
LOAD * INLINE [
Customer,StartDate,EndDate,Rate
A,2/24/2018,6/20/2018,100
B,4/1/2018,7/4/2018,200
C,5/6/2018,,300
];

Sales:
LOAD * INLINE [
SaleNo,Customer,saledate,product
1,A,2/24/2018,1
2,B,4/3/2018,2
3,A,5/6/2018,3
4,B,4/8/2018,2
5,,5/4/2018,2
];

 

 

How can I flag the first sale for each customer in the load script?

 

For instance, I would like to be able to ultimately show a table that looks like this.

Screen Shot 2022-03-01 at 5.48.38 PM.png

 

Any help on this would be greatly appreciated!

Labels (3)
1 Solution

Accepted Solutions
chaorenzhu
Creator II
Creator II

You can use firstvalue()

first_sales:
load Customer,firstvalue(SaleNo) as firstSaleNo, firstvalue(saledate) as firstSaleDate
resident Sales group by Customer order by SaleNo

View solution in original post

3 Replies
chaorenzhu
Creator II
Creator II

You can use firstvalue()

first_sales:
load Customer,firstvalue(SaleNo) as firstSaleNo, firstvalue(saledate) as firstSaleDate
resident Sales group by Customer order by SaleNo

PrashantSangle

multiple function will help you to achieve your requirement

1: min()

2: FirstSortedValue()

you can use both function in script as well as chart. 

find below link of explanation 

https://help.qlik.com/en-US/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/Scripting/Aggrega...

 

Thanks & Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
lostSquirrel112
Contributor II
Contributor II
Author

Perfect! Thanks for your help!