
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Any help on this would be greatly appreciated!
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use firstvalue()
first_sales:
load Customer,firstvalue(SaleNo) as firstSaleNo, firstvalue(saledate) as firstSaleDate
resident Sales group by Customer order by SaleNo

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use firstvalue()
first_sales:
load Customer,firstvalue(SaleNo) as firstSaleNo, firstvalue(saledate) as firstSaleDate
resident Sales group by Customer order by SaleNo

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Thanks & Regards,
Prashant Sangle
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 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perfect! Thanks for your help!
