Select top 3 records of a column using list functions | Community
Skip to main content
rossc47800017
Level 2
May 10, 2018
Solved

Select top 3 records of a column using list functions

  • May 10, 2018
  • 5 replies
  • 3714 views

Hi, whats the best way to identify the greatest 3 values in a column using 'list of functions'?

Regards

Ross

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Marcel_Szimonisz

Hello rossc47800017​,

If you have finite scores and they are predefined you can do following:

Test data

1) create column for every score in enrichment per customer

   using IfEquals(score,'1' , '1','')

Result:

2) add another enrichment where you aggregate into one record

You can use any function for your scores (MAX,MIN) just for aggregation to work

Result

Hope this is close to what you need,

Marcel

5 replies

Marcel_Szimonisz
Community Advisor
Community Advisor
May 10, 2018

Hello,

I do not think so you can do it with "list of functions". But after your query activity add split.

1) in Record count limitation choose "Limit the selected records" option click edit

2) Keed the first ones after sorting

3) choose column and order

4) Choose size of records to keep

Hope this helps,

Marcel

rossc47800017
Level 2
May 11, 2018

Hi Marcel, thanks for this that did work!

I will admit I like to figure stuff out on my own through trial and error, however, I am struggling with this one. I think it's best if I provide a little more context about what I'm actually trying to do.

This is all about personalisation blocks in the template and where a value equals something they get a particular block in priority order, top down. Those values are coming through in a file, where a contact has duplicate rows and on each of those rows is a score. As discussed previously I want to pick up the top three scores, however, that leaves me with three rows per contact. I need to then transpose those values from a column to a row so that I can pass through one row per contact. This is why I was initially looking at using a function.

Any further thoughts?

Regards

Ross

Marcel_Szimonisz
Community Advisor
Marcel_SzimoniszCommunity AdvisorAccepted solution
Community Advisor
May 14, 2018

Hello rossc47800017​,

If you have finite scores and they are predefined you can do following:

Test data

1) create column for every score in enrichment per customer

   using IfEquals(score,'1' , '1','')

Result:

2) add another enrichment where you aggregate into one record

You can use any function for your scores (MAX,MIN) just for aggregation to work

Result

Hope this is close to what you need,

Marcel

rossc47800017
Level 2
May 17, 2018

Hi Marcel, thank you for this.

Yes, this is what I needed and with a bit of trial and error, I got there!

Thank you, greatly appreciated.

Regards

Ross

Marcel_Szimonisz
Community Advisor
Community Advisor
May 17, 2018

Mark as answered if so it would be appreciated

thank you..