Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Kat92
Contributor III
Contributor III

Set analysis Calculation Issue

Hi,

I want to calculate the number of days that specific users have between 3 and 4 ids as count.

I used the calculation below and created a table with the users (from dimensional table that is connected with our fact table where the IDs are found). When I filter one user from a filter then it gives back correct results for this specific user.

However when I do not apply any filter and see the list with users it is always 0.

Calculation:

Count({< [Date] = {"=Count( DISTINCT [ID]) >= 3 and Count(DISTINCT [ID]) <= 4"} >} DISTINCT [Date])

Does anyone have an input?

 

Thanks in advance

Labels (1)
1 Solution

Accepted Solutions
anderseriksson
Partner - Specialist
Partner - Specialist

No, you can't count per user in the set analysis because the set analysis is unaware of your dimension.
The set analysis is calculated once on the table
before the expression then is evaluated upon the data set from the set analysis and per dimension row.
The set analysis will never take your dimension into account.
You need to trash your set analysis and do it in the expression without set analysis.
Something like;
Count(distinct Aggr(if(Count(distinct ID) = 3 or Count(distinct ID) = 4, Date), User, Date))

View solution in original post

5 Replies
anderseriksson
Partner - Specialist
Partner - Specialist

You do not recognize how set analysis works.
Set analysis is applied to your data model before the the expression is evaluated and without any relation to your dimensions in the visualization!
The part  {"=Count( DISTINCT [ID]) >= 3 and Count(DISTINCT [ID]) <= 4"} will count IDs for all users and probably that is more than 4 per day thus your data set is empty after the set analysis is applied.
But when you have one user selected it works because then the set analysis only counts IDs for that user.
You need the condition for number of IDs to be in the expression, not in the set analysis.

Kat92
Contributor III
Contributor III
Author

Thank you for the reply! I am new to Qlik Sense so I have a lot of black boxes regarding how set analysis works.

As I understand I need to adapt the set expression in Set analysis in order to calculate the expression per user?

I have tried some changes like below but again I have the same

Count( DISTINCT {< [Date] = {"=Aggr(Count(DISTINCT [Call Name]),[User],[Date]) >= 3 and Aggr(Count(DISTINCT [Call Name]),[User],[Date]) <= 4"} >}[Date])

anderseriksson
Partner - Specialist
Partner - Specialist

No, you can't count per user in the set analysis because the set analysis is unaware of your dimension.
The set analysis is calculated once on the table
before the expression then is evaluated upon the data set from the set analysis and per dimension row.
The set analysis will never take your dimension into account.
You need to trash your set analysis and do it in the expression without set analysis.
Something like;
Count(distinct Aggr(if(Count(distinct ID) = 3 or Count(distinct ID) = 4, Date), User, Date))

Kat92
Contributor III
Contributor III
Author

That makes sense! And works perfectly, thank you very much for your input

dsfdsewfae
Contributor
Contributor

It seems like you're encountering an issue with set analysis calculations, which is a feature often used in data analysis tools, particularly in tools like QlikView or Qlik Sense. Set analysis is used to create subsets of data based on specific conditions or criteria. If you're facing a problem with your set analysis calculation, here are some general troubleshooting steps:

https://aicalculator.co/shsat-score-calculator/

  1. Syntax Check:

    • Ensure that the syntax of your set analysis expression is correct. A small typo or error in syntax can lead to calculation issues.
    • Double-check the use of curly braces {}, square brackets [], and other set analysis operators
    • Count(distinct Aggr(if(Count(distinct ID) = 3 or Count(distinct ID) = 4, Date), User, Date))

      View solution in original post

      .