7 Replies Latest reply on Jul 17, 2018 4:51 PM by Deepak Rai

# Multiplying data by a list of values

Hi,

I'm trying to multiple data by a list of  values. Units are multiplied by cost/unit and discount multiple. Please see Excel file for first two tables.

This is how my data looks.

 Customer # of units A 42,342 B 4,234 D 10,003 E 647,567 F 42,342

This is the list.

 Cost/unit Discount multiple \$ 1.00 \$                      0.25 \$ 1.00 \$                      0.50 \$ 1.00 \$                      0.75 \$ 1.00 \$                      1.00 \$ 1.50 \$                      0.25 \$ 1.50 \$                      0.50 \$ 1.50 \$                      0.75 \$ 1.50 \$                      1.00 \$ 2.00 \$                      0.25 \$ 2.00 \$                      0.50 \$ 2.00 \$                      0.75 \$ 2.00 \$                      1.00

This is the end products I would like.

 Cost/unit Discount multiple Customer Cost 1 0.25 A \$      10,586 1 0.5 A \$      21,171 1 0.75 A \$      31,757 1 1 A \$      42,342 1.5 0.25 A \$      15,878 1.5 0.5 A \$      31,757 1.5 0.75 A \$      47,635 1.5 1 A \$      63,513 2 0.25 A \$      21,171 2 0.5 A \$      42,342 2 0.75 A \$      63,513 2 1 A \$      84,684 1 0.25 B \$        1,059 1 0.5 B \$        2,117 1 0.75 B \$        3,176 1 1 B \$        4,234 1.5 0.25 B \$        1,588 1.5 0.5 B \$        3,176 1.5 0.75 B \$        4,763 1.5 1 B \$        6,351 2 0.25 B \$        2,117 2 0.5 B \$        4,234 2 0.75 B \$        6,351 2 1 B \$        8,468
• ###### 1. Re: Multiplying data by a list of values

Join your data with a calculated join as shown below:

And then create a calculated field for cost to get the desired output:

Hope this helps.

2 of 2 people found this helpful
• ###### 2. Re: Multiplying data by a list of values

Hi Tarang,

The key to this is the blend data, which allows me to derive the # of units for the calculation on customers. You can then use this inside a calculated field - note the use of ATTR. This is because the # of units is from another data source, so I had to lift the Discount multiple value up to an ATTR as well to make the calculation valid.

I also included an item number column to ensure that the values would remain separate when I loaded them into Tableau.

HTH 18.1 attached

Peter

• ###### 3. Re: Multiplying data by a list of values

Hi Hari,

This is great! Would this work if my "# of units" was a measure and not part of the original data set?

• ###### 4. Re: Multiplying data by a list of values

Yes, it should. Try it out.

1 of 1 people found this helpful
• ###### 5. Re: Multiplying data by a list of values

Wow Hari again..Spot On!!!

• ###### 6. Re: Multiplying data by a list of values

Thanks Deepak. By the way, hope to meet you at TC18.

• ###### 7. Re: Multiplying data by a list of values

Yes .. I will be there