Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
KWHITEHURST
Contributor III
Contributor III

running sum in pivot based on a count(distinct field)

hello can some kindly assist, i've tried numerous ways to determine a running sum based on a count distinct field in a Pivot Table

Pivot rows : Partner Name, RegQtr, Reg Month 
Column     : Reg Year
Measure   : count(Distinct ID) i.e. on the below for Qtr Jan to Mar i need to see:

Jan = 8
Feb = 10
Mar = 12

then needs to reset at next quarter

also i would like an avg column by month within each Qtr i.e. 
Jan = 8
feb = 5
Mar = 4

look forward to hearing from you fingers crossed


KWHITEHURST_0-1720539431425.png

 

Labels (2)
1 Reply
brunobertels
Master
Master

Hi 

not sure but for cumulative sum 

may be this :

 

rangesum(above(

count(Distinct ID)

, 0 , rowno()))

 

For average 

May be this ( but very not sure ) :

 

rangeavg(above(

count(Distinct ID)

, 0 , rowno()))

 

another way could be for average to use the first rangesum expression and divide it by a range sum of count distinct month 

 

rangesum(above(

count(Distinct ID)

, 0 , rowno()))

/

rangesum(above(

count(Distinct Month)

, 0 , rowno()))