10 Replies Latest reply on Feb 7, 2019 2:31 AM by Norbert Maijoor

divide one "group" by the other

so,

I have this workbook that I'm working on, briefly what I need to do is create a new line in the "o que" column, being called "average ticket (like a medium price per store)" this calculation would be:

Total (national + imported) / Store Numbers.

in the example below, for manager Alexandro we would have something like:

The problem is that this "o que" categories come from the database, so how do I add one new "o que category" from a tableau calculation... or something smilar?

• 1. Re: divide one "group" by the other

Is a extract required? If not you could union your table and define a UNION and define your required calculation based on a different table.

Regards,

Norbert

• 2. Re: divide one "group" by the other

Hi Norbert, can you give me a small example? not sure how to do this way...

• 3. Re: divide one "group" by the other

Could you share a workbook in .tbwx format?

Regards,

Norbert

• 4. Re: divide one "group" by the other

Hi, It's on my main post

• 5. Re: divide one "group" by the other

The attached workbook is based on an extract. Could you provide a workbook in .tbwx format not based on an extract?

Regards,

Norbert

• 6. Re: divide one "group" by the other

Oh, i had no idea, this is my first time sending .tbwx here.. should i let it as Live data? if yes here it comes

• 7. Re: divide one "group" by the other

This is easy to do..

1st there is no direct way to achive this functionality, you have to create 2 differnt worksheet and layer them visually on a dashboard. i hope you can figure out that.

now on 1st worksheet, you create the report as ususal

on second report, you can creat the Calculation as needed and use that metric to create 2nd report.

for label, you can use a text container on the dashboard.

• 8. Re: divide one "group" by the other

Find my approach based on a union as reference below and stored in attached workbook version 10.5 located in the original thread.

1. Define a Union

2. D1. O que & Average Ticket:

If [Table Name]='Planilha1' then [O que]

elseif [Table Name]='Planilha11' then 'Average Ticket' END

elseif attr([Table Name])='Planilha11' then sum([Realizado])/sum([Number of Records]) end

4. Drag the required objects to the indicated locations and untick Show Header for Table Name

Hope it helps

Regards,

Norbert

1 of 1 people found this helpful
• 9. Re: divide one "group" by the other

Hi Norbert!

thank you so much for your answer, as I am starting in Tableau some approaches are still new to me. I liked the way you solved it, initially I have done 2 different woorkbooks and put them together in the same panel but I thought there was a lot of duplication of information ... with this approach I was able to solve it!

the only thing I changed on your approach was the M1 formula to show the exact number I needed:

elseif attr([Table Name])='Planilha11' then

=)

• 10. Re: divide one "group" by the other

Glad it worked out for you. My "calculation" was just an example;) more important you got the principle of using union as a 'placeholder' for a diffierent calc on the same dataset.

Thanks for the "Badges". Much appreciated:))

Regards,

Norbert