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

Cumulative line graph

Hi,

I want to create cumulative line graph

The data is like

Date       Profit    Capital    

1/1/17      10          100

2/1/17      30           200

3/1/17      40          300

4/1/17      50           400

I want to divide Profit/Capital and want to take cumulative of that as an expression to chart.

Any suggestions?

1 Solution

Accepted Solutions
sunny_talwar

Try this

RangeSum(Above(If(RowNo() = 1, 1, Sum(PL)/Sum(Capital)), 0, RowNo()))

View solution in original post

11 Replies
sunny_talwar

May be like this

RangeSum(Above(Profit/Capital, 0, RowNo()))

Anonymous
Not applicable
Author

if I want to sort by date in ascending order? Should i use sortable aggr?

sunny_talwar

If the sort is correct in script, then you can just use Aggr(), but if it isn't then you will have to use sortable aggr

Anonymous
Not applicable
Author

In the expression for the first value,it should give default as 1 because there is no above value,like

RangeSum(Above(Profit/Capital, 0, RowNo()),1)


and can we use noofrows() instead of rowno()?

sunny_talwar

May be like this

If(RowNo() = 1, 1, RangeSum(Above(Profit/Capital, 0, RowNo())))

Will have to check based on your data if NoOfRows can work on not.... but why do you want to use it?

Anonymous
Not applicable
Author

was trying out other options. Thanks

Will check with live data and mark correct answer.

zebhashmi
Specialist
Specialist

=Profit/Capital + Above()

Anonymous
Not applicable
Author

Hi Sunny,

The above expression is giving me wrong result.

I want default value for min date to be 1,and then it should accumulate.

sunny_talwar

What would the number look like for the sample data you have provided above?