12 Replies Latest reply: Nov 8, 2018 9:28 AM by Sunny Talwar

# Set Analysis based on Rank

Hi,

I'm struggling with this issue for several days.

I want to calculate the Total value of the N customers with the same conditions.

Meaning, first calculate the total sale per Customer with some conditions (set analysis), then rank them, and finally sum the total sales for the first N top customer. the N is a variable the can be changed by the user.

somthing like this

sum(<{Field1={''},field2={''}, Customer = { Rank( sum(< {Field1={''},field2={''} > Sales } <= \$(NTopCustomer))} Sales)

thanks

• ###### Re: Set Analysis based on Rank

Try this

Sum({<Field1 = {''}, field2 = {''}, Customer = {"=Rank(Sum({<Field1 = {''}, field2 = {''}>} Sales)) <= \$(NTopCustomer)"}>} Sales)

• ###### Re: Set Analysis based on Rank

at first, it didn't work, but I found out what was the problem

one of my conditions is based on a variable

[DATE.autoCalendar.QuartersAgo]={"<=\$(DateRangeSelection)"}

• ###### Re: Set Analysis based on Rank

What are Field1 and field2? Are these placeholders for your actual fields or that is what they are called? If they are the real field names, make sure you have the correct casing for them... meaning is field2 called Field2? or may be Field1 is called field1...

There could be many things which could be not right... difficult to say what might be issue more details. Are you able to share a sample if what I mentioned above is not an issue

• ###### Re: Set Analysis based on Rank

my conditions are

[DATE.autoCalendar.QuartersAgo]={"<=\$(DateRangeSelection)"} , [CHANNEL]={'DIRECT'}

• ###### Re: Set Analysis based on Rank

May be try one of these

[DATE.autoCalendar.QuartersAgo]={"<=\$(=DateRangeSelection)"}

or

[DATE.autoCalendar.QuartersAgo]={"<=\$(=\$(DateRangeSelection))"}

• ###### Re: Set Analysis based on Rank

nope still -

• ###### Re: Set Analysis based on Rank

How do you define DateRangeSelection?

• ###### Re: Set Analysis based on Rank

it's working in the set analysis outside the Rank

it's a variable that gets the value from the extension "Variable Toggle" and the options are:   0 , 3 , 7

• ###### Re: Set Analysis based on Rank

Have you checked that the variable actually takes a value once you set it using your extension? Check the variable overview and see what value do you see for DateRangeSelection variable

• ###### Re: Set Analysis based on Rank

By the way, i'm using it in other Set Analysis and it's working perfectly. only inside the Rank it's giving a null result

• ###### Re: Set Analysis based on Rank

Not sure, would you be able to share a sample to check this out?

• ###### Re: Set Analysis based on Rank

i cant export an app from our servers.

what information do you need in order to help me?

• ###### Re: Set Analysis based on Rank

Well I am not sure what might be going on which is why I ask to see the app. I am not sure if I will be able to know what the issue might be without looking. May be someone else can help.