Qlik Community

Ask a Question

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Welcome to our newly redesigned Qlik Community! Read our blog to learn about all the new updates: READ BLOG and REPORTED ISSUES
cancel
Showing results for 
Search instead for 
Did you mean: 
Partner
Partner

Last 14 weeks trend QlikSense implementation

I have below input table and a filter to select Year and Week.

My requirement is to see the trend in line chart for last 14 weeks from the week I select.

YearWeek NoSales
20181100
20182101
20183102
20184103
20185104
20186105
20187106
20188107
20189108
201810109
201811110
201812111
201813112
201814113
201815114
201816115
201817116
201818117
201819118
201820119
201821120
201822121
201823122
201824123
201825124
201826125
201827126
201828127
201829128
201830129
201831130
201832131
201833132
201834133
201835134
201836135
201837136
201838137
201839138
201840139
201841140
201842141
201843142
201844143
201845144
201846145
201847146
201848147
201849148
201850149
201851150
201852151
20191122
20192123
20193124
20194125
20195126
20196127
20197128
20198129
20199130
201910131
201911132
201912133
201913134
201914135
201915136
201916137
201917138
201918139
201919140
201920141
201921142
201922143
201923144
201924145
201925146
201926147
201927148
201928149
201929150
201930151
201931152
201932153
201933154
201934155
201935156
201936157
201937158
201938159
201939160
201940161
201941162
201942163
201943164
201944165
201945166
201946167
201947168
201948169
201949170
201950171
201951172
201952173
201953174

 

Please help

7 Replies
Master II
Master II

you selected week and year or just week ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Master II
Master II

and check the attached version

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Partner
Partner

I can select anything. Either year or week. or both

Partner
Partner

Hello,

Try this

If(GetSelectedCount(Year)>0,
Sum({<[Week No]={">=$(=Min([Week No])) <=$(=Min([Week No])+14)"}>}Sales),
Sum({<[Week No]={">=$(=Max([Week No])-14) <=$(=Max([Week No]))"}>}Sales)
)

Regards,

Prashant

Partner
Partner

If I select any week like 3 or 4 in 2019, it has to show last 14 weeks starting from previous year. In your case, that is not happening. 

Let's say I select 1st week of the current year, it has to give trends for last 13 weeks of last year and 1st week of current year

MVP
MVP

Create a week sequence field in the script and try like shown in attached sample.

 

MVP
MVP

this expression should work

=sum({<Year,[Week No],Year={"$(=max(Year))"},[Week No]={">=$(=max([Week No])-14)<=$(=max([Week No]))"}>}Sales)