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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
david145
Contributor II
Contributor II

QlikSense YearWeek x Axis pivot table limit values

hi,

i have a pivot table where my column dimension field is a year week field with values like "2022-Wk01", "2022-Wk02"....etc..

i have data for weeks going into end of 2023(so "2023-wk52"), however i only want to my pivot table to show future weeks data for the upcoming 20 weeks from the current week(and all previous weeks). i do not want to show every future week

what would be the correct formula to do something like this? 

thank you

Labels (3)
2 Replies
JordyWegman
Partner - Master
Partner - Master

Hi David,

The easiest way would be to create an indicator and use this in the set analysis.

So create a formula that says something like below. Add this in your script. Not the front-end.

IF( Date <= AddMonths( Date , 5 )
     , 1
     , 0
) as _indAllWeeksUntil20WeeksInFuture


Then get your measure  in the front-end and add this in the set analysis:

Sum( Sales ) 

becomes

Sum( {$< _indAllWeeksUntil20WeeksInFuture = {1} >} Sales )

Jordy

Climber

Work smarter, not harder
david145
Contributor II
Contributor II
Author

 @JordyWegman  thank you for your reply,

your logic in creating a flag is a good one however im not sure its operating as expected for my data set:

i have inputed the flag in my script:

david145_0-1660141787477.png

 

my "WeekStartDate" field has values from start of 2022 to end of 2023 in this format:

david145_1-1660141887297.png

however as you can see. the flag only has 1 and not the 0 value?

and when 1 is selected, the dataset does not change

any ideas? do i need to use a different date format in my flag statement?