Note that there are some explanatory texts on larger screens.

plurals
  1. POpivot.js summary with pseudofunctions
    primarykey
    data
    text
    <p>I've been having some trouble though with a pseudofunction of a summary field with division of two fields.</p> <p>the original two fields are:</p> <pre><code>{name: 'purchasers', type: 'integer', rowLabelable: false, summarizable: 'sum', displayFunction: function(value){ return accounting.formatNumber(value)}}, {name: 'spend', type: 'float', rowLabelable: false, summarizable: 'sum', displayFunction: function(value){ return accounting.formatMoney(value)}} </code></pre> <p>with the pseudofunction being:</p> <pre><code>{ name: 'spendperpurch', type: 'float', pseudo: true, pseudoFunction: function(row){ return row.spend / row.purchasers }, summarizable: 'sum', displayFunction: function(value){ return accounting.formatMoney(value)} } </code></pre> <p>and it's just not aggregating right from the granu</p> <p>What I would like to do is essentially do a sum(row.spend) / sum(row.purchasers) group by filters instead of a </p> <p>for i in row Σ (row.spend/row.purchasers) , which is what is currently happening. </p> <p>e.g. if i have 100 rows with the calculated field spend/purchasers</p> <pre><code>date, purchasers, spend, spendperpurch 1 , 10 , 100 , 10 2 , 15 , 200 , 13.3 </code></pre> <p>if in my table i only want</p> <pre><code>purchasers, spend, spendperpurch </code></pre> <p>the current code gives me:</p> <pre><code>purchasers, spend, spendperpurch 25 , 300 , 23.3 </code></pre> <p>where what i really want is:</p> <pre><code>purchasers, spend, spendperpurch 25 , 300 , 12 </code></pre> <p>any ideas? I would greatly appreciate any help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload