Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

11 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 🙂
Jones28210
Contributor II
Contributor II

A really good post, very thankful and hopeful that you will write many more posts like this one. PaybyPlateMa Pay Online

vikasshana
Creator II
Creator II
Author

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

GrantElliot
Contributor
Contributor

Thanks for sharing its solution, Fortunately My issue has been fixed now. PaybyPlate Ma

HarryStones
Contributor
Contributor

Can you also help me in fixing this issue, as I'm facing the same issue from quite some time.  MostlyBoating

marnusdavid
Contributor
Contributor

To take the value from the previous month and add it to the next month, you'll need to follow these steps:

1. **Gather Data**:
- Ensure you have the data for both the previous month and the current month available.

2. **Identify the Value**:
- Determine the specific value or data point you want to carry over from the previous month.

3. **Access the Previous Month's Value**:
- Depending on your data storage and organization, you may need to retrieve the value from a spreadsheet, database, or any other source where it's stored.

4. **Perform the Addition**:
- Once you have the value from the previous month, add it to the value for the current month.

Example (if using a simple variable in programming):

```python
previous_month_value = 100 # Replace with your actual value
current_month_value = 200 # Replace with your actual value

next_month_value = current_month_value + previous_month_value
```

Example (if using a spreadsheet like Excel):
- Assuming the previous month's value is in cell A1 and the current month's value is in cell B1, you can use the formula `=B1 + A1` in another cell to get the result.

5. **Verify the Result**:
- Double-check your calculations to ensure the addition was performed correctly.

6. **Use the Result**:
- Depending on your specific use case, you can now utilize the combined value for your purposes.

Remember, the exact method for performing this task may vary depending on the context. If you're working with specific software or programming languages, the syntax and steps may be slightly different. disney hub login

KiaraAdvani
Contributor
Contributor

That was a great post! I'm thankful and excited for more like it in the future.