Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
@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:
my "WeekStartDate" field has values from start of 2022 to end of 2023 in this format:
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?