7 Replies Latest reply: Mar 17, 2017 4:53 AM by Sunny Talwar

# Set Expression Question

Assuming the following data:

QuoteVersionTotal
A1\$500
A2\$1000
A3\$700
B1\$1200
B2\$800
C1\$900

I was trying to create a Measure that would only calculate the Total from the MAX version, so in this case \$700, \$800 and \$900 and display them in a table like this:

QuoteTotal
A\$700
B\$800
C\$900

But my formula isn't working. I thought the formula would look something like this:

Sum({<Version=Max(Version)>} Total)

or

Sum({<Version={Max[Version]}>} Total)

The top formula doesn't give me a value. The bottom gives me \$0 every time. What am I doing wrong? Do Set Expressions work in Tables?

• ###### Re: Set Expression Question

try to use

Sum({< Version ={\$(=Max(Version))} >} Total)

• ###### Re: Set Expression Question

May be this

FirstSortedValue(Total, -Version)

• ###### Re: Set Expression Question

HI,

try to use expression like,aggr(FirstSortedValue(sale,-version),quote)

• ###### Re: Set Expression Question

vijeta, your solution worked like a charm! Thank you.

• ###### Re: Set Expression Question

If you got your solution then please mark it as correct and close the thread.

Thanks!

• ###### Re: Set Expression Question

You want to unnecessarily use Aggr() function (when it is not even needed here)? Did you even try this expression?

FirstSortedValue(Total, -Version)

I think you should avoid using Aggr() function unless I am missing something here.... Check my response and attached image and application above and see if it gives what you wanted

Re: Set Expression Question

• ###### Re: Set Expression Question

Aggr function should be wrapped in an aggregation as it returns an array of values;