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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
AmesMoral
Contributor
Contributor

Narrowing values based on multiple fields

I'm building my first sheet and running across a problem. 

Product Order Date Status Status Date
A 12/10/2022 Canceled 1/5/2023
A 12/10/2022 Canceled 1/5/2023
A 1/10/2023 Paid 1/10/2023

 

Let's say I have a scenario like the above, I'm trying to eliminate duplicates. I only need the most recent order in my dataset.

Filtering by only Paid in my dataset won't work for the project I'm working on. 

 

Any ideas?

Labels (6)
2 Replies
Digvijay_Singh

Are you looking solution at front-end or at script level?

May be try something like this at script level.

Data:
LOAD
Product,
"Order Date",
Status,
"Status Date"
FROM [lib://data]
(html, utf8, embedded labels, table is @1);

Concatenate(Data)
Load * inline [
Product, Order Date, Status, Status Date
B, 1/10/2023, Paid, 1/30/2023
B, 1/10/2023, Canceled, 1/10/2023
C, 1/12/2023, Canceled, 2/10/2023
C, 1/12/2023, Paid, 2/19/2023
C, 1/14/2023, Canceled, 2/15/2023
];

NoConcatenate

Data_Final:
Load distinct FirstSortedValue(Product,-"Status Date") as Product,
FirstSortedValue("Order Date",-"Status Date") as "Order Date",
FirstSortedValue(Status,-"Status Date") as Status,
FirstSortedValue("Status Date",-"Status Date") as "Status Date"
Resident Data
Group By Product,"Order Date"
Order By Product,"Status Date"
;
Drop table Data
;

 

Digvijay_Singh_0-1677208858032.png

 

AmesMoral
Contributor
Contributor
Author

This was helpful. Thank you! 

Is there a way to do this on the front end?

I need this to work with general data. Inline is great when I want to narrow specific data, but I'm creating a working sheet that'll update daily, so I need the data to concatenate on it's own when these situations arise. 

Any ideas on how to alter the load script or do this front end?