Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Limit the total amount of expression

Good morning.

I have a table where I have two fields that are grouped with their values.

tabela.JPG

Need to group on a chart table, the total price never pass 900.00.

If you arrive to 900.00 is created a new line with the rest and so on.

tabela2.JPG

If we were to limit for number of records could use a field with "div (rowno (), 900) + 1 the Group", but I'm willing to limit the sum of the values.

Can someone help me?

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

Good correction

A better solution

rangemax(0,rangemin(900,Sum(F3)-(ValueLoop(1,10)-1)*900))

Capturar.PNG

View solution in original post

9 Replies
Clever_Anjos
Employee
Employee

Please find attached one possible solution

sunny_talwar

Clever Anjos‌ I think this would need to be dynamic as what happens if this is the data:

LOAD * INLINE [

    F1, F2, F3

    13, 90, 100

    13, 90, 200

    13, 90, 100

    13, 90, 600

    13, 90, 100

    13, 90, 200

    13, 90, 100

    13, 90, 600

];

Correct me if I am wrong Marcio Arruda‌‌, but I think the solution then would be 900, 900, 200 in three rows

Clever_Anjos
Employee
Employee

Good correction

A better solution

rangemax(0,rangemin(900,Sum(F3)-(ValueLoop(1,10)-1)*900))

Capturar.PNG

sunny_talwar

Super with the second dimension changed to ValueLoop(1, 10)

Anonymous
Not applicable
Author

First, thank you for your response.

I understand, but when you use really will not know beforehand what the total values nor how many rows will need to complete the full amount. Which lists need to be dynamic.

I made some changes and is an example where choosing jurisdiction is 12/2015 the value of the third row is negative.

Anonymous
Not applicable
Author

Corrigir Sunny T

Anonymous
Not applicable
Author

This solution is best.

Clever_Anjos
Employee
Employee

We need to set a maximum, for example 100.

You can extrapolate, to 1.000 or 10.000, at the cost of performance

Anonymous
Not applicable
Author

I understood Clever Anjos, but the way you did has served me.

Thank you so much.