Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
vikasshana
Creator II
Creator II

How to take previous month value and add it to next month

Hi,

I've the below data in my model.

Date Sales
12/26/2021 100
2/10/2022 200
2/29/2022 300
6/20/2022 400

 

I'm looking for an output as below.

Date Sales
12/26/2021 100
1/1/2022 100
2/10/2022 300
2/29/2022 600
3/1/2022 600
6/20/2022 1000

 

In the Data Model I don't have sales for 1/15/2022 & 3/18/2022 so it has to simply copy the previous month data in to that month. Sales for 2/10/2022, 2/29/2022 & 6/20/2022 has to be cumulative of existing previous months sales.

@PrashantSangle @tresesco @sunny_talwar 

Regards,

Vikas

1 Solution

Accepted Solutions
PrashantSangle

Hi,

 

Assuming you have data like below

Table:
Load Date(Date#(Date,'MM/DD/YYYY')) as Date, Sales Inline [
Date, Sales
12/26/2021, 100
2/10/2022, 200
2/28/2022, 300
6/20/2022, 400
];

Date:
Load Date(Date#(Date,'MM/DD/YYYY')) as Date Inline [
Date
12/26/2021
1/1/2022
2/10/2022
2/29/2022
3/1/2022
6/20/2022
];

 

Then your front end you have to use below expression

RangeSum(Above(Sum(Sales),0,RowNo(TOTAL)))

PrashantSangle_0-1661575698646.png

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

3 Replies
sidhiq91
Specialist II
Specialist II

@vikasshana  Could you please be more clear with your requirement. It seems to be little difficult to interpret what you wanted in the form of code.

PrashantSangle

Hi,

 

Assuming you have data like below

Table:
Load Date(Date#(Date,'MM/DD/YYYY')) as Date, Sales Inline [
Date, Sales
12/26/2021, 100
2/10/2022, 200
2/28/2022, 300
6/20/2022, 400
];

Date:
Load Date(Date#(Date,'MM/DD/YYYY')) as Date Inline [
Date
12/26/2021
1/1/2022
2/10/2022
2/29/2022
3/1/2022
6/20/2022
];

 

Then your front end you have to use below expression

RangeSum(Above(Sum(Sales),0,RowNo(TOTAL)))

PrashantSangle_0-1661575698646.png

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
vikasshana
Creator II
Creator II
Author

Thanks @PrashantSangle , with some changes I can able to achieve what I'm looking for.