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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
mechanix85
Contributor
Contributor

data for previous months

Hello. Is it possible to create a table with data for the previous month without filtering any fields? below table and expected result

LOAD * INLINE [
year,month,Measure
2019,1,467
2019,2,462
2019,3,472
2019,4,473
2019,5,120
2019,6,126
2019,7,245
2019,8,177
2019,9,127
2019,10,102
2019,11,492
2019,12,471
2020,1,314
2020,2,310
2020,3,333
2020,4,184
2020,5,494
2020,6,474
2020,7,343
2020,8,80
2020,9,0
2020,10,0
2020,11,0
2020,12,0
];

the number of lines for each month is more than 1

for 2019 the data must be null

Снимок.PNG

 

Labels (1)
2 Replies
rubenmarin

Hi, having only two years you can use: If(year=2020, Sum(TOTAL <month> {<year={2019}>} Measure))

Another option that can work for morre than 2 years can be adding another field to store data from last year, like:

 

OrigData:
LOAD * Inline...

// Add data for Last Year
Left Join (OrigData)
LOAD year+1 as year,
	month,
	Measure as Measure_LY
Resident OrigData;

 

 

mechanix85
Contributor
Contributor
Author

alas, but the option with Join is not suitable, because data volume is about 13 million lines. I would like to solve the problem through measure