Skip to main content

Hello! I am trying to create a calculated field that finds the % difference between the number of complaints and the number of products shipped. I have the products on my rows, and shipping year on my columns. Each cell contains the Shipping Value above the Complaints #. I thought I could just create a calculated field like this:

 

COUNT([DataSourceOrder].[OrderNumber])/COUNT([Ship Confirm Date])

 

But I am getting numbers that use all values not just from each cell, I want ONLY the values in each cell to calculate the difference. Below is an image of the table I have. Is there a way to create a calculated field that only affects each cell?

 

Calculated Field that divides two values in a cell?

3 answers
  1. Oct 4, 2023, 6:57 PM

    Hello @Spencer Morrison​ and welcome to the forums.

    From what you've said, I'm going to guess you're using data blending, and you haven't set up the blend between the two sources correctly, so the count from one side is joining to all of the data on the other side (this is my guess at what "use all values" means). So, firstly, data blending has been largely replaced by relationships, and if you have a little orange tick mark anywhere in the top left of your worksheet, I'd consider that a bad thing (I just never got on with data blending).

     

    As an aside, if you paste an image into your question, just show us the whole screen, a table of data doesn't give us any useful information at all.

     

    So, if it was a conscious decision to use Blending rather than a Relationship between your sources, you'll need to examine your Blend relationship fields. If not, and it just happened, then I'd recommend this as a quick read:

    https://help.tableau.com/current/pro/desktop/en-us/relate_tables.htm

    and then recreate your dataset.

     

    If I'm way off the mark then, as the others have suggested, being able to see your workbook would help us all out.

0/9000