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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
johnnyjohn
Creator II
Creator II

Average by time column

Gurus, 

I'm trying to calculate the cumulative average of the price by increasing time column per ID

Can you help with a formula to do this please? 

johnnyjohn_0-1647261841048.png

 

 

 

Labels (2)
5 Replies
chrismarlow
Specialist II
Specialist II

Hi,

Because ParentID is your first column (so RowNo() restarts with each set) and assuming the sorting stays the same, I think it should be;

rangeavg(above(sum(Price),0,RowNo()))

Cheers,

Chris.

johnnyjohn
Creator II
Creator II
Author

Thanks Chris, 

Doing that only seems to basically just copy the price column, it does not do any cumulative averaging 

chrismarlow
Specialist II
Specialist II

Hi,

Hmmm, curious. When I did a simple model it worked (see below), but agree when you add in another dimension it fails;

20220314_2.png

Cheers,

Chris.

brunobertels
Master
Master

Hi may be this 

 

rangeavg(above(sum(<Id,Time>Price),0,RowNo()))

johnnyjohn
Creator II
Creator II
Author

Thanks, however that formula doesn't seem to work. It expression isnt getting parsed  (missing ')' )