Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
prasadmundewadi
Contributor III
Contributor III

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.

Thanks in advance.

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

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

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

HIC

View solution in original post

4 Replies
petter
Partner - Champion III
Partner - Champion III

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...

hic
Former Employee
Former Employee

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

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

HIC

prasadmundewadi
Contributor III
Contributor III
Author

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

prasadmundewadi
Contributor III
Contributor III
Author

I used this:

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