
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Set Analysis two fields not equal
I want to sum the sales of the customers not beloning to a that segment last year.
I'm trying:
Sum( {$<[SEGMENT 2012]-=[SEGMENT 2013]>} SALES)
but this is not a correct expression.
Second question: How would the syntax looks like if I hadn't had the SEGMENT spilt up in years:
Sum( {$<YEAR={2012},[SEGMENT]-=YEAR={2013},[SEGMENT]>} SALES)
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this
Sum( {$<YEAR={2012},[SEGMENT]-={$(=only({<YEAR={2013}>}[SEGMENT]))}>} SALES)
hope this helps


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See attached example...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, I see your expression is also not accepted as correct syntax judging the red curly lines.
Should I ignore this?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ignore that "Red" curly lines..expression will ork..
Some how qlikview hates notequal sign "-=".

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this
Sum( {$<YEAR={2012},[SEGMENT]-={$(=only({<YEAR={2013}>}[SEGMENT]))}>} SALES)
hope this helps

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LoL, your expression works but...doesn't give the right answer.
Somehow the customers with the same segment in 2012 and 2013 are also stated in the sum(sales)
Even stranger, when I want to see what the sales of the customer in the same Segment as last year are:
Sum( {$<YEAR={2012},[SEGMENT] = {$(=only({<YEAR={2013}>}[SEGMENT]))}>} SALES)
This expresion returns 0.
So '-=' includes the same segments and '=' excludes it 😉
Somebody any thoughts (hopefully without sending a sample of the document)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think I've just answered a similar question here. Perhaps that helps you find your solution. I think you're looking for the e() function for indirect set analysis expressions.
talk is cheap, supply exceeds demand
