5 Replies Latest reply on Sep 3, 2018 7:56 AM by Shinichiro Murakami

# Combining the Lookup and Total functions

Hello everyone!

I have Sales Volume by month, in which I'm using to calculate share of market using percent of total calculation which is basically SUM([Sales Volume]) / TOTAL(SUM([Sales Volume]))

Now I want to get the same share of market for last year. If I want to get the volume of last year, I basically use the Lookup function which would be Lookup(Sum(Sales Volume),-12)...now I want to get share of market..so I need to divide by the Total Sales Volume of LAST YEAR. Once if try to do that by doing Lookup(sum(sales volume),-12) / Lookup(Total(SUM(Sales Volume)),-12) the calculation is valid but it doesn't give me anything!

Please if you have any idea to make the combination of the Lookup and Total functions work together..I would be extremely grateful!

Message was edited by: Mohamed Mosbah

• ###### 1. Re: Combining the Lookup and Total functions

Could you please attach sample data as twbx format.

Thanks,

Shin

• ###### 2. Re: Combining the Lookup and Total functions

Thanks for your kind reply. I've attached the file. So basically I want this 6MMA is calculating the difference in volume between June and January. I want to convert this difference in Volume to difference in share of market. I can easily do it through tableau's quick calculations but I want to write the code itself in a separate calculated field.

Let me know if that doesn't make sense or if you need further clarifications.

• ###### 3. Re: Combining the Lookup and Total functions

Hope this helps.

Thanks,

Shin

1 of 1 people found this helpful
• ###### 4. Re: Combining the Lookup and Total functions

Perfecto! Thank you so much!

• ###### 5. Re: Combining the Lookup and Total functions

Mohamed,

You are welcome.

Shin