# Set analysis compare 2 fields

Hi

How can i compare values in 2 fields in a set analysis.

Something like below but i am not able to get the syntax correctly.

Sum ({<SnapshotQuarter = {<\$(=CurrentQuarter)}>}Sales)

All I want is Sum of Sales for all the SnapshotQtr which are previous to CurrentQtr. And i am specifically looking for a set analysis syntax.

• ###### Re: Set analysis compare 2 fields

Is CurrentQuarter really a field? It seems more natural that it is a variable. But then again I dont know much about the context for this expression.

This might work

Sum ({<SnapshotQuarter = {"<\$(CurrentQuarter)"}>}Sales)

The double quotes denotes a search.

I presume that both SnapshotQuarter and CurrentQuarter also contains the year they belong to so the search will be including the right quarters.

They could be like 2018Q1 and 2017Q4

or 201801 and 201704...

• ###### Re: Set analysis compare 2 fields

If SnapshotQuarter and CurrentQuarter both are numeric fields, the following might work:

Sum ({\$<SnapshotQuarter = {"=SnapshotQuarter<Min(CurrentQuarter)"}>} Sales )

HIC

• ###### Re: Set analysis compare 2 fields

Yes the 2 fields are numeric. I assigned unique numbers in sending order to each quarter. This worked but I removed Min. Did not need that.

Sum ({\$<SnapshotQuarter = {"=SnapshotQuarter<Min(CurrentQuarter)"}>} Sales )

Thank you hic

• ###### Re: Set analysis compare 2 fields

I used this:

Sum ({\$<SnapshotQuarter = {"=SnapshotQuarter<(CurrentQuarter)"}>} Sales )