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

FirstSortedValue in set analysis

Hi, guys.

My set analysis:

sum({<_C3Meses_VENDAS_={1},DES_CD={'$(=FirstSortedValue(DES_CD,-(aggr(sum({<_C3Meses_VENDAS_={1}>}VB),DES_CD,BANDEIRA)),1))'}>}VB)

don't work.

if i isolate the expression ////  =FirstSortedValue(DES_CD,-(aggr(sum({<_C3Meses_VENDAS_={1}>}VB),DES_CD,BANDEIRA)),1))  ////  , it work normally.

any sugestion?

thz!

André

Labels (3)
1 Solution

Accepted Solutions
jberna26
Partner - Contributor III
Partner - Contributor III

Hi @AndreFrencl ,

 

I understood now what you are trying to achieve.

 

You should use double quotes:

sum({<_C3Meses_VENDAS_={1},DES_CD={"$(=FirstSortedValue(DES_CD,-(aggr(sum({<_C3Meses_VENDAS_={1}>}VB),DES_CD,BANDEIRA)),1))"}>}VB)

 

Not sure it will fix the problem, but single quotes are reserved for literal strings, and double quotes are used when some kind of search or function is applied.

 

Let me know if it fixes the issue.

Regards

 

View solution in original post

3 Replies
jberna26
Partner - Contributor III
Partner - Contributor III

Hi @AndreFrencl ,

 

can you give us an example of what you are trying to achieve? And what kind of data?

Usually, in my experience, FirstSortedValue is more commonly used to get a string, which you cannot sum, otherwise you would use the Max function. 

If you can give us examples maybe we can help 😉

AndreFrencl
Contributor III
Contributor III
Author

hi, @jberna26 

the function

 =FirstSortedValue(DES_CD,-(aggr(sum({<_C3Meses_VENDAS_={1}>}VB),DES_CD,BANDEIRA)),1))

the function bring to me a string, like "RS", "AP", "CO", ....

 

so, my goal is like this:

sum({<_C3Meses_VENDAS_={1},DES_CD={'RS'}>}VB)

 

both functions works, but not together.

(sorry my english)

jberna26
Partner - Contributor III
Partner - Contributor III

Hi @AndreFrencl ,

 

I understood now what you are trying to achieve.

 

You should use double quotes:

sum({<_C3Meses_VENDAS_={1},DES_CD={"$(=FirstSortedValue(DES_CD,-(aggr(sum({<_C3Meses_VENDAS_={1}>}VB),DES_CD,BANDEIRA)),1))"}>}VB)

 

Not sure it will fix the problem, but single quotes are reserved for literal strings, and double quotes are used when some kind of search or function is applied.

 

Let me know if it fixes the issue.

Regards