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: 
Purushothaman
Partner - Creator III
Partner - Creator III

Cumulative Count and Cumulative Distinct Count - Backend Script

Hi @ogster1974 ,

One last help from your end.  Below is my raw table. 

Purushothaman_0-1674031733147.png

 

My Requirement is: 

1) Cumulative Count of Account throughout AccountOpendate where Account Status = A

2) Cumulative Distinct Count of Account throughout AccountOpendate where Account Status = A

I would need to achieve this backend without limiting the rows by using where clause.

 

My end Results in backend should be:

Purushothaman_1-1674032010821.png

 

I have the raw file for your reference. 

As I stuck in this logic for few days, your help will be grateful. 

Thank you!

 

 

1 Solution

Accepted Solutions
ogster1974
Partner - Master II
Partner - Master II

This works.

Raw:
LOAD
Account,
Party,
AccountOpendate,
"Account Status"
FROM [lib://Community:DataFiles/Req1701.xlsx]
(ooxml, embedded labels, table is Raw);

 

NoConcatenate
EndResult:
Load
*,
If(Account='A1',1,
If("Account Status"='A',Peek('AccountStatus_A_Accumulated_Total')+1, Peek('AccountStatus_A_Accumulated_Total'))
) as AccountStatus_A_Accumulated_Total,
If(Party='AA',1,
If("Party"<>Peek("Party"),Peek('Party_Accumulated_Total')+1, Peek('Party_Accumulated_Total'))
) as Party_Accumulated_Total
Resident Raw
Order By [Party]
;

 

ogster1974_0-1674034374877.png

 

View solution in original post

1 Reply
ogster1974
Partner - Master II
Partner - Master II

This works.

Raw:
LOAD
Account,
Party,
AccountOpendate,
"Account Status"
FROM [lib://Community:DataFiles/Req1701.xlsx]
(ooxml, embedded labels, table is Raw);

 

NoConcatenate
EndResult:
Load
*,
If(Account='A1',1,
If("Account Status"='A',Peek('AccountStatus_A_Accumulated_Total')+1, Peek('AccountStatus_A_Accumulated_Total'))
) as AccountStatus_A_Accumulated_Total,
If(Party='AA',1,
If("Party"<>Peek("Party"),Peek('Party_Accumulated_Total')+1, Peek('Party_Accumulated_Total'))
) as Party_Accumulated_Total
Resident Raw
Order By [Party]
;

 

ogster1974_0-1674034374877.png