Forum Discussion

Anna123456's avatar
Anna123456
Frequent Visitor
3 years ago
Solved

TopN with returns too much

Hello, 

 

When I use TopN for 2 it gives me more than 2 records back ... it gives me all the records that have one of the 2 maximum numbers. How can I restrict the output to 2? And if multiple values have the maximum number it should choose a random sample.... 

 

Example: 

A: 3
B: 7

C: 7
D : 7 

E: 4
-> Top 2 gives me C,D,B, E (because the 2 maximum numbers are 7 and 4)  but I just want C and D (or C and B ... does not matter, but just 2). 

 

Can you help me? 

 

~Anna 

 

2 Replies

  • WinterMist's avatar
    WinterMist
    Icon for Impactful Individual rankImpactful Individual

    Anna123456 

     

    First, put the Top 2 Numbers into a table VAR (which will return 3 rows of Number 7).

    Second, get the Top 2 Letters from the table VAR in Step 1 above.

     

     

    Regards,

    Nathan