1 Reply Latest reply on Apr 11, 2017 1:13 PM by Bora Beran

# Help! Create a proportional ztest calculation for "weighted data" in tableau?

Hi, I am working with weighted survey data and need to create a significant Testing calculation (Please see attached for reference).  This is easy to do in SPSS  and I know how to do the Z-test for unweight data in tableau.

However, this one is different it needs to be for Weighted data.

My questions are as follows:

• Can tableau even handle this calculation?
• Will it be better to use R or a different tool to get this calculation ready at the data source level and then get it in tableau?

If you know any other post that is already discussing or that solved this issue please let me know. In addition, I am open to any suggestions you can find online.

• ###### 1. Re: Help! Create a proportional ztest calculation for "weighted data" in tableau?

The document you attached talks about computing weighted variance estimates. Is what you're asking for how to compute the weighted variance so you can use it for z-test (which you already know how to do in Tableau)?

If so weighted variance can be written as an LOD expression. If you're doing it for the entire table it can be written in the following form.

First calculated field is weighted mean, let's call it Wmean

{SUM([Weight]*[X])/SUM([Weight])}

Then the variance calculation SPSS uses (relies on the Wmean calculation)

SUM([Weight]*([X]-[Wmean])^2)/SUM([Weight]-1)

Note that this uses a fixed LOD expression for Wmean that computes the mean of x over the entire table

You can learn more about level of detail (LOD) expressions here

What’s new in Tableau 9.0? Part 2 – Level of Detail Expressions | Bora Beran