Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am having a line chart with the quarter and year in the x-axis.
If I am selecting Q3-2021 so dynamically in the x-axis it should show Q4-2020>>Q1-2021>>Q2-2021>>Q3-2021.
Is it possible to achieve this using any any function or expression?
Thanks in advance
Not sure of how your QuarterYear field is calculated and/or the Dates are used in your data, but the following is the approach that you could use.
In your dimension, use:
=aggr(Only({1<[Date Field]={"<=$(=Date(max({1<QuarterYear=$::QuarterYear>} [Date Field])))>=$(=Date(Addmonths(max({1<QuarterYear=$::QuarterYear>}[Date Field]),-12)))"}>} [QuarterYear]),[QuarterYear])
The {1< tells Qlik to ignore selections and the set analysis will limit the QuarterYear only those within a year of the maximum [Field Date] of the available data. As you filter on QuarterYear, the max([Date Field]) will adjust.
In you measure, you will need to include [QuarterYear]= in your set analysis to ignore the selection of [QuarterYear], something like:
sum({$<[QuarterYear]=>} Value)
You may need to add other set analysis to the dimension expression depending on what other field might be filtered.