Tableau: Average by Dimension

时间:2016-02-12 22:00:16

标签: tableau

I would like to average x by N for values of Type

My data is set up as:

Inst

So I would like to see a table (or bar chart) with Type, Inst, N A, A1, 4 A, A1, 13 A, A1, 13 A, A2, 4 A, A3, 5 B, B1, 4 B, b2, 10 . Any suggestions? If I put A: 13, B:7 in rows and AVG(N) in columns I get Type

The problem is that Tableau is averaging all A: 7.8, B:7 per N, but I want the numerator to be the total Type for the N while the denominator is the number of unique Type within that Inst

2 个答案:

答案 0 :(得分:3)

将计算字段desired_avg创建为

{FIXED [Inst] : SUM([N])}

把它放在表格中。

选择汇总为AVG而不是SUM

如果有效,请告诉我!

答案 1 :(得分:1)

定义以下计算字段

        if(!isset($_SESSION['stdname']))
   {

   echo'<script>if (confirm("Session Timeout. Please Re-Login")){window.location = "index.php"}else{} value="Ok"</script>';

    }