Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jag7777777
Contributor III
Contributor III

Set analysis with variables

Hi,

I have a couple of variables, each having the same sort of structure - which is summing stuff together. e.g.

vMarketableWeight = (SUM[field A] + SUM[field B] + SUM[field C] etc....)

These work fine when called from within a visualization with $(vMarketableWeight).

I've hit a snag using these with set analysis. The syntax I want to use is:

SUM({$<

    MarketableOrOutsize = "",

    [Size Bucket] = ""

    >}

    $(vMarketableWeight)/($(vMarketableWeight) + $(vOutsizeWeight))* 100

    )

This bit: $(vMarketableWeight)/($(vMarketableWeight) + $(vOutsizeWeight))* 100 works fine on its own.

I'm guessing it's something to do with sums of sums - or evaluation precedence....but my knowledge is limited.

Any ideas please?

I don't want to change the structure of my variables as they're well used.

Cheers,

Labels (1)
12 Replies
jag7777777
Contributor III
Contributor III
Author

Hi Vineeth,

I misled a bit (sorry) I was trying to empty the two set modifiers (and forgot the syntax! - no swirly brackets or quotes required!!)

It still doesn't work - but this is effectively what I'm trying to do (but with the parts separated as you've suggested):

SUM({$<

    MarketableOrOutsize =,

    [Size Bucket] =

    >}

    $(vMarketableWeight)  )

/

(

SUM({$<

  MarketableOrOutsize =,

    [Size Bucket] =

    >}

    >} $(vMarketableWeight) )

+

SUM({$<

  MarketableOrOutsize =,

    [Size Bucket]=

    >}

    >} $(vOutsizeWeight) )

)

Still pretty sure its the whole SUM or SUM thing that's the problem (i.e. each of the three variables are pretty much the same - i.e. SUM[field a] + SUM[field b] + SUM[field c] etc..

It's done like this because we're able to choose these fields in filter visualisations.

Cheers,

vinieme12
Champion III
Champion III

oh k, instead or Sum() + sum()

try Rangesum(field1,field2...etc)  

in the first scenario if any value is null the whole expression becomes null, whereeas rangesum() will adjust for 0's

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

Can you upload a sample to look at

Preparing examples for Upload - Reduction and Data Scrambling

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.