The Spotfire Community is moving to TIBCOmmunity and this forum location has closed. During the transition, you can still search the old forums but posting has been disabled. We encourage you to pick up the discussion at the new Spotfire community on TIBCOmmunity.
Weighted average - TIBCO Spotfire Community

Weighted average

Last post Thu, Jun 7 2012 8:37 AM by Ryan Weber. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • Fri, Feb 24 2012 1:42 AM

    • JMH
    • Top 500 Contributor
    • Joined on Thu, Feb 23 2012
    • Posts 7

    Weighted average

    I am trying to calculate a weighted average of a certain parameter, say a material (M) weighted by cost (C).  I have used either the "WeightedAverage" function in spotfire and a custom equation to calculated the weighted average.  The result of this expression should be a single value.  However, when I try to put it on a bar chart or some other visualization, it requires me to provide an aggregation method as if there are multiple values present.

     Can someone provide some insight into why Spotfire is doing this?

     Thanks,

     Joel

  • Thu, Mar 1 2012 3:35 PM In reply to

    Re: Weighted average

    Have you tried wrapping it into an avg() ? If it is only one value, it should not change it.

    Christof

    -----------------------------------
    Dr. Christof Gaenzler
    Sr Solutions Consultant
    TIBCO Spotfire
  • Fri, May 4 2012 2:53 PM In reply to

    • larfme
    • Not Ranked
    • Joined on Fri, May 4 2012
    • Posts 3

    Re: Weighted average

    I have a similar issue. I put in the weightedaveragefunction with the two values and it gives me the same value on every line in the data set.

    Here is a simple example of fake numbers showing the issue. When I I place the weightedAvg number in the bar chart I of course get bars of equal length no matter how I divide up the data.

    Row     Value1 Value2 weightedAvg
    Row 1  7.2          8          53.3
    Row 2  6.3          9          53.3

  • Thu, Jun 7 2012 8:37 AM In reply to

    • Ryan Weber
    • Top 10 Contributor
    • Joined on Thu, Jun 7 2012
    • Oklahoma City, OKC
    • Posts 186

    Re: Weighted average

    If you want a unique value for groups in a calculated column, you need to use the over statement to provide the scope of the weighted average (i.e. county level, state, country, etc.)  Example as follows:

    WeightedAverage([Weight_Column],[Value_Column]) over ([County])

    If you only need to visualize the answer, and not use it in another calculation, you should be able to do it in a bar chart, and then choose rowid as your x-axis selector to expand the weighted average to the entire data set (or choose a grouped column to set a different scope)

    Hope that helps!

    Thanks,
    Ryan

     

    Hope that helps!

    Thanks,
    Ryan
Page 1 of 1 (4 items)
©Copyright 2000-2011 TIBCO Software Inc | Privacy Policy | Terms of Use I Blog I Contact Us I Content Center