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

Filter by FirstSortedValue

I'm new to QlikSense and struggling with a issue related to distinct records and/or FirstSortedValue. Unfortunately, other posted solutions have not resolved my problem.

I have a data set with customer interaction data, which includes multiple records for customers. This information is organized with a PivotTable by interaction month, customer type, customer location and other related dimensions.

I would like the ability to show only a unique customer record for the month of the first interaction. Ideally, I could apply this logic to both my PivotTable and other visualizations on the page. 

Although I tried applying the 'FirstSortedValue' formula in my PivotTable, it returned the date, customer# or number of the first interaction as the 'value'. Given that I'm organizing by date, I want to return a single count for a given customer, for month of the first interaction (not the date as the value). This will allow me to display how many first customer interactions occurred in each month.

If QlikSense doesn't allow this with the 'Measure' expression within a PivotTable, is there a way to apply as a filter for the entire page, enabling me to only show the first interaction for all tables/visualizations?

I would appreciate any help that you can provide. Thank you

5 Replies
sunny_talwar

Would you be able to share a sample where we can see your issue?

erikbalunis
Contributor
Contributor
Author

No problem; thanks for your willingness to help.

As requested, I included a few examples in the table below and, in some instances, there are multiple records per customer. I would like to focus on the "first " interaction and to have the ability to filter-out (exclude) the subsequent records , enabling me to better assess (and analyze) the duration.

Let me know if you have any other questions. I appreciate  any support and insight that you can provide.

Customer#Initial Customer Outreach Date/TimeCustomer Interaction Date/TimeDuration
478599713/11/2019 6:54:25 PM3/13/2019 10:11:09 AM1.6366
478599703/11/2019 6:53:55 PM3/12/2019 7:50:15 AM0.5391
478599703/11/2019 6:53:55 PM3/14/2019 6:50:15 PM2.9975
478599703/11/2019 6:53:55 PM3/15/2019 11:44:15 AM3.7016
478599693/11/2019 6:53:40 PM3/12/2019 9:50:17 AM0.6227
478599683/11/2019 6:53:05 PM3/12/2019 2:33:15 PM0.8196
478599683/11/2019 6:52:55 PM3/16/2019 2:20:10 PM4.8106
478599673/11/2019 6:52:55 PM3/13/2019 1:50:08 PM1.7897
478599663/11/2019 6:52:20 PM3/14/2019 12:30:18 PM2.7347
478599653/11/2019 6:51:35 PM3/13/2019 11:10:15 AM1.6796
478599653/11/2019 6:50:55 PM3/19/2019 9:23:17 AM7.6058
478599643/11/2019 6:50:55 PM3/14/2019 9:55:34 AM2.6282
478599643/11/2019 6:50:55 PM3/19/2019 11:03:40 AM7.6755
478599633/11/2019 6:50:25 PM3/12/2019 8:10:47 AM0.5558
478599623/11/2019 6:49:25 PM3/12/2019 10:21:52 PM1.1475
478599613/11/2019 6:48:55 PM3/12/2019 2:50:22 AM0.3343
478599613/11/2019 6:47:45 PM3/13/2019 12:50:19 PM1.7518
478599603/11/2019 6:47:25 PM3/12/2019 8:22:33 AM0.5661
478599603/11/2019 6:47:25 PM3/13/2019 9:20:13 PM2.1061
478599603/11/2019 6:47:25 PM3/13/2019 1:55:18 PM1.7971
478599603/11/2019 6:47:25 PM3/15/2019 12:50:24 PM3.7521
478599603/11/2019 6:47:25 PM3/18/2019 11:05:17 AM6.6791
dplr-rn
Partner - Master III
Partner - Master III

You maybe able to do it in front end through some aggr expression or similar.
but did you try creating a flag while loading the table. this would be simplest
i.e. load the data ordered by customer id and interaction date. then use previous function to create a flag
if(customer#<>previous(customer#), 'Y','N') as firstinteraction_flag

hope i understood correctly
erikbalunis
Contributor
Contributor
Author

Thanks for the feedback and I have a quick question: would I use the 'previous' function (and flag) in the same 'LOAD' statement? or would I need a different LOAD statement?

dplr-rn
Partner - Master III
Partner - Master III

Load with the necessary order and you should be able to use it in same load statement