Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
a272070
Contributor II
Contributor II

Set Analysis with Axes Min/Max, Should Not change on Filter

Hello,

I am using a set analysis expression in my chart.

Sum({1<[Calendar Year] = {"$(=Max({1}[Calendar Year]))"}>} DISTINCT [Sales Percentage]) <-- Used for current year

Sum({1<[Calendar Year] = {"$(=Max({1}[Calendar Year])-1)"} >} DISTINCT [Sales Percentage]) <--- Used for previous year

The dimension for this chart is [Calendar Month]. 

Here is the chart below that it makes whenever I put the min and max values in the axes tab. I put min(Sales percentage) and max(Sales percentage) for both the current year and previous year expressions in the scale section under the axes tab. 

jhgty43_0-1628541580806.png

If I don't put the min and max values, then the chart looks like this, which is not as nice and spaced out. 

jhgty43_1-1628541774386.png

The issue is, I don't want this chart to do anything when I filter, I want it to stay the same as the set analysis should with the {1} where they are currently as shown above...

But the issue is, when I filter and I have the min and max values in the axes tab, it does this: 

jhgty43_2-1628541864381.png

Is there a way to fix this so it does not change when filtering but I can also use the min and max axes values so that it looks like the second image at all times no matter what filter?

Thanks in advance!

1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

First you need to carry your set analysis to your min/max axis calculation.  I am doing >= max year -1 which will include both years.

min({1<[Calendar Year] = {">=$(=Max({1}[Calendar Year])-1)"}>} [Sales percentage])

max({1<[Calendar Year] = {">=$(=Max({1}[Calendar Year])-1)"}>} [Sales percentage])

 

But this (and your original calculation) aren't aggregating Sales percentage by month for min/max... this is just the max row value.  That would only be the same if you have 1 value per month.

If you do need to aggregate first it would be like this:

=max({<[Delivery date] = {">=$(=Max({1}[Calendar Year])-1)"}>}aggr(sum({<[Delivery date] = {">=$(=Max({1}[Calendar Year])-1)"}>} [Sales percentage]), [Calendar Month]))

and change outermost function to min.

View solution in original post

2 Replies
stevejoyce
Specialist II
Specialist II

First you need to carry your set analysis to your min/max axis calculation.  I am doing >= max year -1 which will include both years.

min({1<[Calendar Year] = {">=$(=Max({1}[Calendar Year])-1)"}>} [Sales percentage])

max({1<[Calendar Year] = {">=$(=Max({1}[Calendar Year])-1)"}>} [Sales percentage])

 

But this (and your original calculation) aren't aggregating Sales percentage by month for min/max... this is just the max row value.  That would only be the same if you have 1 value per month.

If you do need to aggregate first it would be like this:

=max({<[Delivery date] = {">=$(=Max({1}[Calendar Year])-1)"}>}aggr(sum({<[Delivery date] = {">=$(=Max({1}[Calendar Year])-1)"}>} [Sales percentage]), [Calendar Month]))

and change outermost function to min.

a272070
Contributor II
Contributor II
Author

Thank you so much. This worked for me!