Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Purushothaman
Partner - Creator III
Partner - Creator III

Accumulation Count and Grouping in Data Load Script

Dear @hic ,

Requesting your expertise on the below;

I have a table with dates, Month Year,  Client Grouping ,Client code  Account Status.

How can I accumulate the data by throughout the Date Field by ClientCode where Account Status = A , By Grouping by Client Grouping

Purushothaman_0-1673855674401.png

My End Result of Accumulation should be:

Purushothaman_1-1673855857756.png

 

Please help!!

Thank you

1 Solution

Accepted Solutions
ogster1974
Partner - Master II
Partner - Master II

This will work.

[RawData]:
LOAD
1 as _RowCount,
[dd/mm/yyyy],
Dual(Date(monthstart([dd/mm/yyyy]), 'MMM-YY'),Month([dd/mm/yyyy]) &'-'&Year([dd/mm/yyyy])) as [Month Year],
[Client Grouping],
[Client Code],
[Account Status]
FROM [lib://Community:DataFiles/Req.xlsx]
(ooxml, embedded labels, table is [Raw Data]);

 

[EndResultTmp]:
LOAD
[Client Grouping],
[Month Year],
Sum([_RowCount]) as [Total]

Resident [RawData]
Where [Account Status]='A'
Group By
[Client Grouping],
[Month Year]

;

Drop table [RawData];

NoConcatenate
EndResult:
Load
*,
If([Client Grouping] = Previous([Client Grouping]),
RangeSum(Peek('Accumulated_Total'), Total),
Total) as Accumulated_Total
Resident EndResultTmp
Order By [Client Grouping]
;

Drop table [EndResultTmp];

 

ogster1974_0-1673863081742.png

 

View solution in original post

2 Replies
ogster1974
Partner - Master II
Partner - Master II

This will work.

[RawData]:
LOAD
1 as _RowCount,
[dd/mm/yyyy],
Dual(Date(monthstart([dd/mm/yyyy]), 'MMM-YY'),Month([dd/mm/yyyy]) &'-'&Year([dd/mm/yyyy])) as [Month Year],
[Client Grouping],
[Client Code],
[Account Status]
FROM [lib://Community:DataFiles/Req.xlsx]
(ooxml, embedded labels, table is [Raw Data]);

 

[EndResultTmp]:
LOAD
[Client Grouping],
[Month Year],
Sum([_RowCount]) as [Total]

Resident [RawData]
Where [Account Status]='A'
Group By
[Client Grouping],
[Month Year]

;

Drop table [RawData];

NoConcatenate
EndResult:
Load
*,
If([Client Grouping] = Previous([Client Grouping]),
RangeSum(Peek('Accumulated_Total'), Total),
Total) as Accumulated_Total
Resident EndResultTmp
Order By [Client Grouping]
;

Drop table [EndResultTmp];

 

ogster1974_0-1673863081742.png

 

Purushothaman
Partner - Creator III
Partner - Creator III
Author

Hi @ogster1974 ,

You are super great and helpful.

Thanks a lot!! 🙂