Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

prasadmundewadi
New 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
Employee
Employee

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

4 Replies
MVP
MVP

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

Employee
Employee

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

prasadmundewadi
New Contributor III

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

prasadmundewadi
New Contributor III

Re: Set analysis compare 2 fields

I used this:

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

Community Browser