Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
krish2459
Creator
Creator

Week Cummilation Issue

Hi,

Please help me with the below requirement.

krish2459_1-1652700849991.png

 

Attaching the sample data and in the data we need to consider week '2244' .

 

Thanks,

Kishore

Labels (1)
1 Solution

Accepted Solutions
Andrei_Cusnir
Specialist
Specialist

Hello,

 

Based on the data that you have provided in the screenshots here is an approach that you can follow:

 

NOTE: You can take that idea in case it resolve the issue and apply it on the dataset of the EXCEL file that you have provided.

 

1. I have loaded the dataset (Screenshots😞

 

2. For the "Cummulative" column I have used the expression:

If(
    YearWeek<=2342, 
    Aggr(RangeSum(Above(Sum(ActualValues), 0, RowNo())), ActualValues), 
    Max(TOTAL Aggr({<YearWeek={"<=2342"}>} RangeSum(Above(Sum(ActualValues), 0, RowNo())), ActualValues)) + Sum(TOTAL {<YearWeek={">=2343"}>}ActualValues)
)

 

3. The outcome is:

 

As you can see, it counts the sum of above until YearWeek 2342 and then adds that value to the sum of the rest and use that amount for all the left records. This is the same observation that you have mentioned that you expect on your side.

 

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members. 
 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂

View solution in original post

1 Reply
Andrei_Cusnir
Specialist
Specialist

Hello,

 

Based on the data that you have provided in the screenshots here is an approach that you can follow:

 

NOTE: You can take that idea in case it resolve the issue and apply it on the dataset of the EXCEL file that you have provided.

 

1. I have loaded the dataset (Screenshots😞

 

2. For the "Cummulative" column I have used the expression:

If(
    YearWeek<=2342, 
    Aggr(RangeSum(Above(Sum(ActualValues), 0, RowNo())), ActualValues), 
    Max(TOTAL Aggr({<YearWeek={"<=2342"}>} RangeSum(Above(Sum(ActualValues), 0, RowNo())), ActualValues)) + Sum(TOTAL {<YearWeek={">=2343"}>}ActualValues)
)

 

3. The outcome is:

 

As you can see, it counts the sum of above until YearWeek 2342 and then adds that value to the sum of the rest and use that amount for all the left records. This is the same observation that you have mentioned that you expect on your side.

 

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members. 
 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂