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

Distributing amount in buckets on front end

Hi All,

I am facing issues in distributing the amount on the front end among the Buckets.

Ex: Amount to be distributed : 240

FromToRequired Amount
0100100
100200100
20030040
300999990

Please advise !!!

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

Try with this expression

if(Sum (Values)>To, To-From, If(Sum(Values)>From, Sum(Values)-From, 0))

View solution in original post

18 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

What is the output you are expecting, can you come up with an example of source data and expected data.

Regards,

Jagan.

Not applicable
Author

Hi Neelam, Are you looking at some sort of a histogram? Please attach something that points to the expected output. thanks.

Not applicable
Author

Hi,

Thanks for the reply!

Actually the example I have mentioned in my post only. I am also attaching an application with Dummy data for reference. There,, I need to distribute the Sum(Values) over the bucket by the Difference of the Buckets.

In the application, if  To - From < Sum(Values) then To, else  remaining Sum(Values)

From    To    Sum(Values)

0            5            5

5            10          5

10          15          1

So My value is 11 which is now distributed over the Buckets based on the difference of the From & To.

Let me you if face any difficulty in understanding my explanation.

Thanks,

Neelam

Not applicable
Author

Hi,

Thanks for the reply!

Actually the example I have mentioned in my post only. I am also attaching an application with Dummy data for reference. There,, I need to distribute the Sum(Values) over the bucket by the Difference of the Buckets.

In the application, if  To - From < Sum(Values) then To, else  remaining Sum(Values)

From    To    Sum(Values)

0            5            5

5            10          5

10          15          1

So My value is 11 which is now distributed over the Buckets based on the difference of the From & To.

Let me you if face any difficulty in understanding my explanation.

Thanks,

Neelam

Not applicable
Author

PFA.

Not applicable
Author

Hi RamKumar,

Thanks a lot for the Solution so quickly!

But actually I tried checking it by changing the values in the Data, then it started giving me incorrect result.

I am trying to change it a bit to get the correct results.

However attaching the application and data file for your reference.

Thanks Again!

Neelam

Not applicable
Author

PFA.

Thanks,

Ram


Not applicable
Author

Hi RamKumar,

Thanks!

I tweaked your formula a bit and got correct result.

But one scenario we left, what if the value itself falls in the very first bucket only i.e. 1,2,3 &4.

I tried but its giving the same values for all the buckets, however the values should fall into first bucket only, and for rest of the buckets will e Zero.

Attaching the file and data for your reference.

Regards

Neelam

Not applicable
Author

Hi

I actually, worked on it and got the result. But I feel it has become complex and might not work on large data sets.

Feel free to share if you have any other way to accomplish this.

Thanks again for the help!

Regards & Best Wishes

Neelam