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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Gaël
Contributor III
Contributor III

Dynamic X axis on a boxplot depending on user selection

I am using Qlik Sense (February 2023 Patch 10).


I want to enhance my current boxplot of continuous_var over time_dim, disregarding the settings of filter_var. Currently, I plot Sum({$<filter_var=>} continuous_var) with [time_dim Year] as X-axis dimension.


As whole years might be a bit coarse, I want to dynamically "make a zoom" on the X-axis and change it to [time_dim YearMonth] depending on the selection of a time span by the user (VizLib's Calendar filter, in my case). Using a drilldown dimension won't work if I want to display months spanning two different years. More generally, I want to display data by week for the last 26 weeks, or by month for the last 24 months, or by quarter for the last 24 quarters, or by year.

I already got this to work for a bar chart of Count(ID) over time_dim, but this does not currently work for boxplots. For the bar chart, I use the following expression for the X axis:
=$(=if(count(distinct {$<filter_var=>} [time_dim YearMonth]) <= 24, '[time_dim YearMonth]', '[time_dim Year]'))
This selects [time_dim YearMonth] instead of [time_dim Year] whenever 24 months or less have been selected.

To avoid empty bars, I use the following expression to replace Count([ID]):
=sum({<filter_var=, [time_dim Date]={">=$(=Min({<filter_var=>} [time_dim Date]))<=$(=Max({<filter_var=>} [time_dim Date]))"} > } Aggr(Count([ID]), [time_dim Date]))
Here, I aggregated over single dates, since I may want to have boxplots by week as well.

For the boxplot, I imagine that I need to replace continuous_var by something along this line:
=sum({...} Aggr(Sum(continuous_var, ID))
But that doesn't do the trick. Any thoughts?

Labels (1)
2 Replies
F_B
Specialist II
Specialist II

Hi @Gaël ,

it seems like you've already put considerable effort into customizing your visualizations, here is an attempt towards your goal, but I would like to point out that I didn't test it:

=sum({<filter_var=, [time_dim Date]={">=$(=Min({<filter_var=>} [time_dim Date]))<=$(=Max({<filter_var=>} [time_dim Date]))"} >} Aggr(Sum(continuous_var), $(=if(count(distinct {$<filter_var=>} [time_dim YearMonth]) <= 24, [time_dim YearMonth], [time_dim Year]))))

 

Gaël
Contributor III
Contributor III
Author

Thanks F_B! I will try that next time I touch the app.