Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to lock a chart viz with a specific date range, in YearQuarters three years ago from today. I tried this with setting the dimension in the chart itself with:
=If([%DateKey.autoCalendar.YearQuarter] >= AddYears(Today(), -3), [%DateKey.autoCalendar.YearQuarter])
but when date selections are made in filterpans for year, month etc. the chart changes.
Is there a way to change a master item such that only the past 3 years are shown on a chart for that measure?
i.e. Revenue = sum([Invoice Revenue]*[FX])
can become something like
RevenueLastThree
= Sum(
{<
[Invoice Date] = {">=$(=Date(AddYears(Today(), -3))) <=$(=Today())"}
>}
[Invoice Revenue] * [FX]
)
Is your only problem, that the measure is still reacting to other filters ?
Just use "1" as set identifier. Qlik will ignore all other filter.
Sum(
{ 1 <
[Invoice Date] = {">=$(=Date(AddYears(Today(), -3))) <=$(=Today())"}
>}
[Invoice Revenue] * [FX]
)
It's a bit more than that, while I understand what 1 will do at the set identifier, it is actually overstating the revenue by Billions. I think I need to clear individual date fields and have the aggregation work out the same as it is for straight "Revenue". I simply want Revenue = sum([Invoice Revenue]*[FX]) over the last three years, in year-quarters in a bar graph that does not change with changes to filter panes. I hope that makes sense and I appreciate the help!
Could this be accomplished with Alternate States? i.e. Alt State called "LastThreeYears"