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

Cumulative Total Calculation Month by Month

Hi All,

 

I have to calculate cumulate Total month by month. can you please check the below attached screenshot and I want to add Jan-21 total to Feb-21 Total; For march, I have to add Jan-21 and Feb-21 data like I need to calculate month on month, can you please guide me on how to achieve this requirement.

 

Product NameJan-21Feb-21Mar-21Apr-21May-21Jun-21Jul-21
Product A100200300400500600700
Product B110210310410510610710
Product C120220320420520620720
Product D130230330430530630730
Product E140240340440540640740
Grand Total60017003300540080001110014700
FormuleTotal sum of all ProductsJan-21GrandTotal+
Total sum of Feb-21 Products
Feb-21GrandTotal+
Total sum of Mar-21 Products
Mar-21GrandTotal+
Total sum of Apr-21 Products
Apr-21GrandTotal+
Total sum of May-21 Products
May-21GrandTotal+
Total sum of Jun-21 Products
Jul-21GrandTotal+
Total sum of Jun-21 Products
Labels (2)
5 Replies
Gopikrishna1
Contributor
Contributor
Author

Hi all,

 

Anyone please check my issue and guide me how to achive my senario

Anil_Babu_Samineni

Perhaps this? PFA

Pick(Dim, RangeSum(Before(Sum(Data), 0, RowNo(TOTAL))), Sum(Data))

Anil_Babu_Samineni_0-1627497451712.png

 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Kushal_Chawda

@Gopikrishna1  No need to create inline dimension. Follow below steps

1) Create Pivot table 

2) In Dimension, Add Product Type in Row, and Month in Column

3) Enable Total for the Dimension Product Type from Dimension Properties

4) Write below Measure

=if(Dimensionality()=0, rangesum(before(total sum(Value)),sum(Value)), sum(Value))

Daniel29195
Contributor III
Contributor III

@Gopikrishna1 
hello, im not sure i did undesrtand your request correctly, but from what i undesrtood ,maybe somthing like this would help , rangesum(before(sum([# Amount]),0,2))

Daniel29195_2-1666984472277.png

 





robert99
Specialist III
Specialist III

If you want a robust solution (allows drill downs by say Month or MonthYear) using a Pivot table say. Or MonthYear  as a dimension in a table

Use AsOfMonth (if you drill down to one month it will still give the correct totals whereas rangesum etc doesn't)

The As-Of Table - Qlik Community - 1466130

or

In your example above you could have 12 measures one for each month (using a table) where ProductName is the only dimension and the Months are measures. And use set analysis so you select a year and it gives the accumulated Month by Month total

 

I have done this where one Year is selected. So 12 expressions are set up to give the accumulated monthly totals as required 

PLActMth is a master Item measure

An example for YTD for 1st 6 months. The year is 

//Label for expression >> 'June ' & Year >> Gives June 2021 if Year is filtered to 2021 

{< Month {Jan,Feb,Mar,Apr,May,Jun}, Month = >}
PLActMth