6 Replies Latest reply on Jun 16, 2016 4:36 AM by Mark Fraser

Comparing 2 fields

Hello,

I would like to compare 2 fields, to calculate a percentage of matching values.

How can in do this?

Thanks!

• 1. Re: Comparing 2 fields

Hoi Dave

Here is a basic example, Excel data, we would want only the yellow rows

In Tableau

Then we can use that figure in a %

its just a basic random example, but I hope it gives you some direction/ help.

If you had more detail (and a sample) I'll try and help further.

Cheers

Mark

• 2. Re: Comparing 2 fields

Hi Mark, thanks for helping me.

Here is the Data Model:

I want to calculate the percentage of matching values between Table A and Table C.

If for example Table A contains products A, B, C and D

and Table C contains products A, B and C, the accuracy is 75%.

This is the measurement I want to calculate.

• 3. Re: Comparing 2 fields

hi Dave

In that case, its all about getting the joins correct.

I replicated a fake data set in Excel, 1 sheet = 1 table (attached)

As mentioned, first its the joins, when you set the data in Tableau, you'll want it to look like this

The important part is highlighted, here is our 75%.

Now to calculate it in Tableau...

The above is very basic (for a reason - to help demo).

But would that give you what you need? and does it make sense?

Cheers

Mark

• 4. Re: Comparing 2 fields

source in Excel

9.3.3 workbook and SQL join diagram attached.

• 5. Re: Comparing 2 fields

Thanks a lot! It was all about making the right joins

• 6. Re: Comparing 2 fields

HI Dave

You're welcome, I assume you got what you wanted?

I have marked my answer correct - if its not please let me know and I'll amend.

I hope the SQL join diagram will be useful to you, once you get the joins right, everything else should become much easier!!

Cheers

Mark