1 2 Previous Next 24 Replies Latest reply on Nov 20, 2015 1:59 PM by Shawn Wallwork Branched to a new discussion.

# Item to fall in all satisfied Condition

Hi All,

I have scenario where as per my condition Item should bucket in all satisfied conditions.

eg:-

IF [Unit Price]<=1  then '1 day UNIT' elseif [Unit Price]<=2 then '2 day UNIT' elseif [Unit Price]<=3 then '3 day UNIT'

elseif [Unit Price]<=4 then '4 day UNIT'

elseif [Unit Price]<=5 then '5 day UNIT'

else '>5 day UNIT%'

end

for example when Unit Price=1 then it should fall in all in all my buckets that is <=1 ,<=2<=3<=4<=5 since all of them are TRUE but my above condition is working when first TRUE is satisfied not to other TRUES,So please let  me know how Items should fall in all satisfied conditions

Krishna

• ###### 1. Re: Item to fall in all satisfied Condition

Hi Krishna, Tableau executes calculations one line at a time, and when it reaches the first true condition it then 'falls' out of the calc. You say "when Unit Price=1 then it should fall in all my buckets". That is not how Tableau works. If the Unit Price = 2, then as far as Tableau is concerned it is NOT equal to 1 or 3 or any other 'bucket'. Even if you reversed the order (5-4-3-2-1) you still wouldn't get the result you seem to want, as I said in the beginning, your calc falls out at the first true condition. Calculations can only have one true condition per row/slice, meaning T calcs are not looping type calcs.

Give us a sample packaged workbook and we can better help you.

Cheers,

--Shawn

• ###### 2. Re: Item to fall in all satisfied Condition

Hi Shawn,

Thank you for the reply..i have already attached sample packaged workbook for your reference.Please let me know if we have a way

Thanks

Krishna

• ###### 3. Re: Item to fall in all satisfied Condition

Krishna, sorry I didn't see the workbook. In the future please note what version you are using, especially if it isn't the latest version. Thanks.

Essentially, you seem to be wanting a running total. In the attached I set this up. To get it to behave the way you want I manually reversed the order of your Metric field. It's a table calc so the set up will be important: Let me know if you have questions.

--Shawn

• ###### 4. Re: Item to fall in all satisfied Condition

Hi Shawn,

Thank you for your time but ideally am not looking for running total.Let me explain you better

if if per a month if i have  total 100 items

in which  10 items falls under each bucket as mentioned above

i.e

Metric:

======

<=1=10

<=2=10+10

<=3=20+10

<4=30+10

<=5=40+10 ideally previous+Current

>5=50

now <=5+>5 =100%

My calculation field in report is calculatinf % that is <1/Total items,<2/Total item..so on

Please find attached updated 8.3 version packaged workbook..oops i could find attach option(please let me know how to insert)

Thanks

Krishna

• ###### 7. Re: Item to fall in all satisfied Condition

It's a two step process. Look at your screenshot, see the Advanced editor... up in the right corner? Click that and then go to the Attach at the bottom of the page.

--Shawn

• ###### 8. Re: Item to fall in all satisfied Condition

Oh sorry i didnt notice..Please see the attachement and let me know if we have a way

Thanks

Krishna

• ###### 9. Re: Item to fall in all satisfied Condition

Hi Shawn,

Do you think we any any solution for this?

• ###### 10. Re: Item to fall in all satisfied Condition

This is what I posted on the other thread:

Vamsi, just like I told Krishna what you are describing is a running total.

Metric:

======

<=1=10 = 10

<=2=10+10 = 20

<=3=20+10 = 30

<4=30+10 = 40

<=5=40+10 = 50

>5=50

(You probably mean for that last one to be 60. If not then delete it and change this line <=5=40+10 = 50

to this >4=40+10 = 50 )

Notice how the totals for each line is adding an increment of 10, that how a running total works. What am I not understanding?

--Shawn

• ###### 11. Re: Item to fall in all satisfied Condition

Hi Shawn ,

Sorry u got is wrong let me explain u with another example

Say My Data be like below under Unit Price field

Unit Price

===

1

1.2

2

2.6

3

4

5

5.6

6  so on

Now condition which i wrote was

IF [Unit Price]<=1  then '1 day UNIT' elseif [Unit Price]<=2 then '2 day UNIT' elseif [Unit Price]<=3 then '3 day UNIT'

elseif [Unit Price]<=4 then '4 day UNIT'

elseif [Unit Price]<=5 then '5 day UNIT'

else '>5 day UNIT%'

end

It is bucketing like

<=1    <=2    <=3    <=4    <=5 and  >5

now when Tableau reads 1 its falling only under  <=1 bucket  but i want 1 to fall under all conditions thats satisfy TRUE

1<=1  ,1<=2, 1<=3,  1<=4 ,1<=5  is TRUE condition and >5 is FALSE condition

Currently:

<=1    <=2    <=3    <=4    <=5 and  >5

Expected:

<=1    <=2    <=3    <=4    <=5      >5

1     1       1      1      1

Similarly say 2.6 comes

Currently:

<=1    <=2    <=3    <=4    <=5 and  >5

1

Expected:

<=1    <=2    <=3    <=4    <=5      >5

1        1        1

It should fall under all satisfied conditions.Please find my Packaged work book as attachment and let me know if there is any solution

• ###### 12. Re: Item to fall in all satisfied Condition

Krishna, I completely understand how you want Tableau to do your calculation, but like I said in the beginning, that is not the way Tableau calculations work. The way you want Tableau to work is essentially a 'simulated' RUNNING_SUM(). I say this because you don't actually want Tableau to stop counting when the first condition is true, you want T to continue counting and only fall out when it hits the first false statement. This will be the equivalent of a running sum.

If you will tell me what you think the values should be for all the cells in the first and last column, I will set something up to match your expectation.

--Shawn

EDIT: Or possible a RUNNING_COUNT.

• ###### 13. Re: Item to fall in all satisfied Condition

Hi Shawn,

Please find attached Sample output Excel file .I contains how my Output should look.

Thank you very much for your effort

• ###### 14. Re: Item to fall in all satisfied Condition

Yes, probably. Just let me know what the desired outcome is for each cell in your sample workbook. Create an Excel file that has all the results you expect from the workbook you posted. I fairly confident we can get to your expected result. We just need to know what that result is.

Hang in there, we'll solve your issue.

--Shawn

1 2 Previous Next