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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
noviceneil
Partner - Contributor III
Partner - Contributor III

visualize data in chart for variable periods on user selection

I have a table with weekly data with weekly timestamp for more than a year. I want to show the data in a line chart but based on user selection for the duration like either last 1 month , 2 months or 4 months stored in a variable. how can it be done in ?
 INPUT :

PERIOD SALES CLOSED
20241002 1,010 179
20241009 902 211
20241016 690 219
20241023 690 219
20241030 690 219
20241106 805 227
20241113 823 225
20241120 853 223
20241127 857 223
20241204 902 211
20241211 956 191
20241218 984 181
20241225 994 181
20250101 1,010 179
20250108 1,030 181
20250115 1,055 183
20250122 1,077 193
20250129 1,139 191
20250205 1,147 191

vSelection = 1 or 2 or 4

Could you please help?

Labels (1)
1 Reply
SRA
Partner - Creator
Partner - Creator

Hi, 

If we consider FDATE loaded with :

Date(Date#(PERIOD,'YYYYMMDD')) as FDATE

You could use a set analysis in you measure to filter on the period you want to display.

Here I consider that with vSelection = 2 you want to display the current month and the previous one : 

Sum({<FDATE={">=$(=MonthStart(Today(),-vSelection+1)) <=$(=Today())"}>} SALES)

Regards