5 Replies Latest reply on Dec 7, 2017 10:17 AM by Joe Oppelt

# Pulling data from one row to another

Hi, I have an interesting situation where I have two products that are supposed to have the same number of products. Product A and B are related. They have the same number of accounts but in the database, Product B's numbers are off.

Is there a way for me to create a query or calculation in Tableau where I can say that for Product B, I will be pulling in Product A's data? Complexity does not matter as long as I can do this. Also, I do not rely on the number of accounts for any other calculation in this situation so I do not mind showing a dummy sort of number if that's possible/the only way.

Thanks!

***EDIT***: I believe the solution of this would have to do with a CASE but can't figure out how to get it to work.

• ###### 1. Re: Pulling data from one row to another

How are you identifying Product A and Product B here?

You can do a FIXED LOD calc that says SUM(IF [Product] = "A" then [value] END)

... and that value will be loaded onto every row in the database.  And then you can have another calc that says

IF [Product] = "B" then [that LOD calc] ELSE [Value] END

This will leave you with a final calc that you would use as your measure instead of your original [value] measure.

So yes, it can be done.

• ###### 2. Re: Pulling data from one row to another

Doing something like this would mean that I would have to use some hard coding right? It wouldn't be able to be automated?

• ###### 3. Re: Pulling data from one row to another

Actually you could sort of automate it.  You could have  parameter that lets the user (or you) select which product is "A", and another for "B".  Then instead of hard-coding "A" and "B" in those calcs, you would use [Param 1] and [Param 2].

• ###### 4. Re: Pulling data from one row to another

I think I'm catching up to what you're saying.

In your previous calculation example, would [Product] be my product name or just the dimension? Secondly, "A" would be the product or a new variable we're assigning to it?

Lastly, what would the [value] mean in this situation? Would that have to be a hard-coded number?

Also, what does a fixed LOD calculation mean? Is that the fact that we have some hard-coded numbers we are working with?

Really appreciate your quick response.

• ###### 5. Re: Pulling data from one row to another

Supply a sample workbook with some sample data.  Tell me what product you want replaced with another product's info. (And what field (or fields) you want replaced.)