2 Replies Latest reply on Nov 2, 2018 9:15 AM by Alexey Virov

# Split Difference Calculation into Positive and Negative

Hello everybody.

I have a daily history of orders (named trips in the book) from clients, and need to show the daily change of those orders.

Net change is easy with Difference Table calculation, but I also need to show growth and loss in orders separately.

That is, if net growth was 5 orders, but that 5 comes from 8 orders increse with one client, and -3 decrease with another, I need to be able to show all these figures, 8, 5, -3 alongside one another.

I could not figure how I could calculate that only positive and only negative difference.

Attached is the test book I was playing with, if someone know how to approach that, I would be quite grateful.

• ###### 1. Re: Split Difference Calculation into Positive and Negative

Can you mock up a visual of what you're hoping to visualize?  I'm not sure exactly what you're after based on the text alone -- it may just be another set of measures with a table calc for difference, but I'm not 100% clear on what you'd like to see in the viz.  The dimensions are super important when considering table calcs, so if you want to do something at the level of "order", the "order id" or "order date" dimension may need to be in view.

I hope this helps -- happy analyzing!

• ###### 2. Re: Split Difference Calculation into Positive and Negative

Hey Matt, thanks for taking interest.

I have actually settled for calculating the initial data set with sql for now - dashboard was needed asap.

I basically iterate thru dates, calculate difference with orders from same client on previous day via FULL OUTER JOIN, thus getting differences, including cases when I need to compare 0 orders on some day (missing row) to . Then in Tableau I can sum positive values, negative values, calculate net value, etc.

Would still appreciate learning a way to acheive that with Tableau, if possible, from raw dataset containing daily orders with missing rows for days when there were none.

Current version looks like that: