Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with Set Analysis

Hi Community:

I have some issues calculating in set analysis.

This is my data. I have many transacionID per contract. What I'm trying to do is to get the Amount on the Max of TransactionID, within the date range (date entered by an user) and when ObjectID = 615. So the red boxes are the Max TransactionID between 10/1/2011 and 9/30/2012.

Data.png

I have calculated the Max of the TransactionID like this:

 

Max({<Date={'>=$(vStartDate)<=$(vEndDate)'}>}TransactionID)

This works fine, but then I want to get the Amount including the above set analysis and does not work.

data2.png

I have tried 2 options:

1. This calculation give me the results only when clicking a Contract, and that is not what I'm looking for. I want to always display the values

  Sum ({<TransactionID={$(=Max({<Date={'>=$(vStartDate)<=$(vEndDate)'}>}TransactionID))}, ObjectID={615}>}Amount)

2. This gives me something else but not the solution

Sum ({<TransactionID={"=Max({<Date={'>=$(vStartDate)<=$(vEndDate)'}>}TransactionID)"}, ObjectID={615}>}distinct Amount)

The expected resultd should be:

ContractAmount
20101214450.00
01297240.00
0140259100.00
0141061250.00
0141731500.00
01537240.00
0155313950.00

//0129724 is 0 because does not satisfy the condition of Obj=615 on the Max. Transaction ID which is 1003

Any ideas? Attached are my files.

Thanks!

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

=FirstSortedValue( {<Date={">=$(vStartDate)<=$(vEndDate)"}>}

     aggr(sum({< ObjectID={615}>} Amount),TransactionID),

     -TransactionID )

)

View solution in original post

7 Replies
fosuzuki
Partner - Specialist III
Partner - Specialist III

Try this:

Sum ({<TransactionID={$(=Concat(aggr(max(TransactionID), Contract), ', '))}, Date={">=$(vStartDate)<=$(vEndDate)"}, ObjectID={615}>}Amount)

jagan
Luminary Alumni
Luminary Alumni

Hi,

Please find the file attached.

Regards,

Jagan.

Not applicable
Author

Thanks Fernado. The expression works, but the issue is my data set is huge. I have millions of transactions and the "Concat" function is taking forever to get all the values for a specific date.

Not applicable
Author

Any other idea without using the "Concat" function?

swuehl
MVP
MVP

Try

=FirstSortedValue( {<Date={">=$(vStartDate)<=$(vEndDate)"}>}

     aggr(sum({< ObjectID={615}>} Amount),TransactionID),

     -TransactionID )

)

Not applicable
Author

Thanks swuehl!! This worked really good. Could you explain please how the FirstSortedValue function worked for this case?

Not applicable
Author

Can you try this?  I just want to see the performance difference.

I think this should reduce the amount of data in Concat() portion.

sum({<TransactionID={$(=concat(aggr(Max({<Date={">=$(vStartDate)<=$(vEndDate)"}>}TransactionID), Contract),', '))}, ObjectID={615}>}Amount)

Sean