Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
midwest
Contributor
Contributor

Inconsistent values when using filters

Hi, 

 

I have a chart indicating the frequency of visits over 2021 and 2022, based on dashboards that we completed in previous years. When I am not using filters, the frequencies are incorrect, but when I am using filters, they are correct, even though the dimension is the year that the service occurred. 

 

midwest_0-1692196292675.png

This screenshots above are incorrect. For 2021, 2 visits should have a frequency of 10, 3 visits should have a frequency of 3. For 2022, 1 visit should have a frequency of 3, 2 visits should have a frequency of 8, and 3 visits should have a frequency of 6. Every other frequency is correct.

When filtering for year (2021/2022), the frequencies are correct.

midwest_1-1692196521657.pngmidwest_2-1692196542635.png

When using the dimension of year as a filter, the frequencies are correct.

 

Does anyone know why this is happening? I am trying to create a report that has a chart of each year, side by side (as it looks in the first screenshot) showing the correct frequencies.

 

Thank you,

 

 

Labels (2)
3 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi midwest,

If you'd like anyone to troubleshoot your charts, please post a sample document, or at least specify all the formulas that you use in your chart - Dimensions and Expressions. Otherwise, we wouldn't have a clue about the issue.

midwest
Contributor
Contributor
Author

Here are my expressions:

count(aggr(if( max(Visit_number)= 1, 1), DQ_Unique_number))

count(aggr(if( max(Visit_number)= 2, 1), DQ_Unique_number))

count(aggr(if( max(Visit_number)= 3, 1), DQ_Unique_number))

count(aggr(if( max(Visit_number)= 4, 1), DQ_Unique_number))

count(aggr(if( max(Visit_number)= 5, 1), DQ_Unique_number))

count(aggr(if( max(Visit_number)= 6, 1), DQ_Unique_number))

count(aggr(if( max(Visit_number)= 7, 1), DQ_Unique_number))

count(aggr(if( max(Visit_number)= 8, 1), DQ_Unique_number))

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Well, if your chart has Year as a dimension, then your AGGR() functions should also include Year in the list of AGGR() dimensions. 

However, there is a better way of achieving the same, using an aggregated dimension, like this:

Dimension:

AGGR(Max(Visit_number), Year, DQ_Unique_number)

Expression:

count(distinct DQ_Unique_number)

I'm teaching a similar solution in my lecture on Set Analysis and AGGR() at the Masters Summit for Qlik. 

Join us at the Masters Summit for Qlik in Orlando or in Dublin to learn advanced Set Analysis, scripting, data modeling, performance, visualizations, and more - delivered by some of the best Qlik experts in the world!