Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Karthick30
Creator
Creator

How to get Dec-22 Value for Jan-23

Hi,

 I have a Dataset which has values from the year 2020. I need to show current year Profit's based on comparison with previous Months

Sample Dataset is like below

Karthick30_0-1687171876783.png

For Jan 23 , Previous value is showing as 0 , but i have value for Dec-22. I need to show Dec -22 value in Jan 23 place. 

Remaining values are coming correctly

Any way to achieve this

 

Labels (2)
1 Reply
jonashertz
Contributor III
Contributor III

First expression limited to 2023. Second expression same as first but: 

- shift monts 1 step with addmonths to catch the 2022-12 row.
- use above function to look up one row so dates match 2023.

 


table:
load * Inline [
date, value
2022-11-01, 10
2022-12-01, 15
2023-01-01, 50
2023-02-01, 40
2023-03-01, 30
2023-04-01, 20
2023-05-01, 60
2023-06-01, 70
2023-07-01, 40
2023-08-01, 30
2023-09-01, 20
2023-10-01, 60
2023-11-01, 70
2023-12-01, 40
2024-01-01, 30
];

exp1 = sum({<date={"=year(date)=2023"}>} value)

exp2 = above( sum({<date={"=year(addmonths(date,1))=2023"}>} value) )

Table must exclude zero values.