Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Gene_K
Partner - Contributor II
Partner - Contributor II

Set Analysis - Set Modifier difference not working as expected

Seems like I misunderstood how the Set Modifier is meant to work.  Would appreciate if someone can clear things up for me.  I'm attaching a sample application which I'm working from.   In the application is a simple data model with a table for games, a table for invites, and a table for participant. 

What I'm trying to count is the number of times a person has chosen to ignore their invite and not participate in the game in a table format where the dimension is the person.  Should be pretty simple. 

The number of games they have been invited to is :  sum({<NumInvites = {1}>} NumGames)

The number of games they participated in is : sum({<NumParticipations = {1}>}NumGames)

Shouldn't the number of games they chose not to participate in be the difference between the two sets?  

=Sum({

  <NumInvites= {1}> -
  <NumParticipations = {1}>
} NumGames)

 

And, yes, I know I can change the logic to 

sum({<NumInvites = {1}>} NumGames) - sum({<NumParticipations = {1}>}NumGames)

but I want to understand why the difference in SetModifiers does not work.

 

 

Labels (2)
1 Solution

Accepted Solutions
rubenmarin

Hi, set analysis is calculated before the table, so dimensions don't affect when creating the subset, it applies after the subset is created. Also it applies to the used fields, and NumGames is on the games table, so the access to NumGames is in a direct relation with gameid.

When you do sum({<NumInvites = {1}>} NumGames), the subset has access to the 3 games, and then applies each person filter to the row.

But when you do <NumInvites= {1}> - <NumParticipations={1}>, and all games has at least one participation, you are removing all games from the subset. and the empty subset is applied to each person, so it returns 0 for all.

If you merge all 3 tables in one using joins it will work as you expect.

View solution in original post

2 Replies
rubenmarin

Hi, set analysis is calculated before the table, so dimensions don't affect when creating the subset, it applies after the subset is created. Also it applies to the used fields, and NumGames is on the games table, so the access to NumGames is in a direct relation with gameid.

When you do sum({<NumInvites = {1}>} NumGames), the subset has access to the 3 games, and then applies each person filter to the row.

But when you do <NumInvites= {1}> - <NumParticipations={1}>, and all games has at least one participation, you are removing all games from the subset. and the empty subset is applied to each person, so it returns 0 for all.

If you merge all 3 tables in one using joins it will work as you expect.

Gakar
Contributor
Contributor

To calculate the number of games a person has chosen not to participate in, you’re correct that you’d typically subtract the number of games they participated in from the number of games they were invited to. And in general, it is much easier to visit a site like https://jeetcitycasino.bet/ and have great fun gambling. However, in Qlik’s set analysis, you cannot directly subtract one set from another in the way you might be thinking. Instead, you need to adjust the calculation within a single aggregation function to reflect the condition you’re interested in.