Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sumeet-vaidya
Partner - Creator
Partner - Creator

Calculation based on previous number

Hi,

Kindly find below table and required otuput. This needs to be achieved in frontend. Please assist.

    

ChannelValue %Calculation !Required Output
A-15If(Negative then 0)0
B5-15+5 = -10 (Again negative then 0)0
C13-10 + 13 = 33
D32 32
E65 65
Total100 100

stalwar1

Regards

Sumeet

1 Solution

Accepted Solutions
sunny_talwar

May be try this

=If(Alt(Above(RangeSum(Above(Sum(Value), 0, RowNo()))), -1) < 0, RangeMax(RangeSum(Above(Sum(Value), 0, RowNo())), 0), Sum(Value))


Capture.PNG

View solution in original post

5 Replies
giovanneb
Creator II
Creator II

Hi, try this,

tmp:

LOAD * Inline [

Channel, Value

A, -15

B, 5

C, 13

D, 32

E, 65

];

tmp1:

LOAD

Channel,

Value,

if(RowNo() = 1, Value,

Peek(x) + Value)  as x

Resident tmp;

DROP Table tmp;

tmp2:

LOAD

*,

if(y < 0, 0, y) as z;

LOAD

*,

if(Peek(x) > 0, Value, x) as y

Resident tmp1;

DROP Table tmp1;

DROP Fields x,y;

Reguards

manoranjan_d
Specialist
Specialist

try this

create one straight table and

add the dimension as channel

expression 1 as sum(value)

expression 2 as =if(RangeSum(Above(Value,0,2))<0,'0',RangeSum(Above(Value,0,2)))

sunny_talwar

May be try this

=If(Alt(Above(RangeSum(Above(Sum(Value), 0, RowNo()))), -1) < 0, RangeMax(RangeSum(Above(Sum(Value), 0, RowNo())), 0), Sum(Value))


Capture.PNG

manoranjan_d
Specialist
Specialist

great

sumeet-vaidya
Partner - Creator
Partner - Creator
Author

Great Sunny..!!! Thanks a ton

Regards

Sumeet