Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need to calculate for previous week based on Date dimension

Hello,

I have the following question. I have a Date dimension. This dimension is a part of the cyclic group which is used in a Straight Table. I have a column in which i need to calculate a value for the the according date - 1 week (7 days).

Please see a screenshot of the straight table:

example.png

Basically I need to calculate values in the second column for the dates previous to dates in the first column. So in the first row of my table I need to calculate data for 05/02/2015. In the second row of my table I need to calculate data for 05/09/2015.

Can you please advise how I can do this?

1 Reply
Gysbert_Wassenaar

I think you need a kind of AsOf table that links each week with the previous week:

AsOfWeeks:

LOAD distinct Week as ReportWeek, Week, 'Current' as Period

Resident ...

Concatenate(AsOfWeeks)

LOAD distinct Week as ReportWeek, date(Week-7) as Week, 'Previous' as Period

Resident ...


You can then use ReportWeek as dimension instead of Week and expressions like sum({<Period={'Current'}>}Value) and sum({<Period={'Previous'}>}Value).


talk is cheap, supply exceeds demand