# Why do we only use SUM when calculating Gross Margin?

I have the same question that Tiffany has: why didn't we use the SUM function when calculating Revenue and Cogs? I am quite confused about the explanation that you provided in the video. If we need to add SUM for Gross Margin, why don't we do the same for Revenue and Cogs that we did a couple of videos before?

Hi Lifang,

Thanks for reaching out and good to hear from you.

We actually used the SUM function earlier too. Could you please refer to the moment when we didn't use it? Thanks!

Best,

Ned

Okay, I think I get it.

When calculating COGS, we made the calculation for each individual sale.

Then Tableau showed us the sum in the visualization, just like it did for other columns.

When calculating Gross Margin, if we don't use SUM, then Tableau will calculate for each individual entry and then show the sum of that. So it actually adds up all the percentages of the individual sales which is why we get huge numbers.

So, when we specifically mention SUM, then Tablue takes the sum of all the months, which is what we want for the correct calculation.

Did I make sense?

HI why did we use the sum to calculate the % of GM.

Thanks

Very poor explanation from the instructor. Both in the video and here in the comment as well. Completely disappointed!!!! Thums down!

@Ned, we actually did not use when making the calculated field COGS, or Revenue, for example. It is not clear why we had to use SUM for the GM% though.