sum column values

I have a column total revenue which is calculated for each customer on a separate row, but I'm wanting to total alll the total revnue values together for all customers then divide each indivudal revenue by the toal to get a % per customer, is this possible?

 

thanks

Comments

  • Cartergan
    Cartergan Contributor

    I am thinking one way you could do this is add a column in which you assign a calculation to be the values. 

    Ex. 

    SELECT 
    SUM(Individual Revenues) AS Total Revenue

    This would give you a column with total revenue as a number, you could then do one more column in which the calculation would be like 

    [Individual Revenues] / [Total Revenue] AS Customer% 

    Aside from column names and a little syntax this should work. Let me know!

  • would I do the first calculation on the dataflow?

  • basically I need to be able to sum all the values in the total revenue column then be able to divide each on individually into that total

     

     

  • Cartergan
    Cartergan Contributor

    In that case, yes, you would do the first calculation on the DataFlow. Doing it there will create a new column in general (it will be the same number the whole column). 

     

    Once you have this column, you can do a BeastMode calculation on a card to calculate the individual revnue % by each customer. If need be, I can post some screenshots on how to do so, but let me know. 

  • yes, if you could post a couple screenshots that would be great

     

    thank you

  • so I have the totals for each customer group together, I just then need another calculation for all of those totaled together....the attched screenshot shows what we did to get the total revenue for each customer, we then need all of those totaled together to get a grand total of total revenue

  • Cartergan
    Cartergan Contributor

    The first part is perfect. This will give us a column we can use for each individual value/calculation. 

     

    The next part would be done in the BeastMode section of the card analyzer. You would add a new calculation to give you the % of revenue by each customer. After this, the calculation will show up as a datapoints on the left hand side which you are able to add to the table. I attached some screenshots to help show which locations I am talking about. 

     

    Let me know if this works for you! 

  • how do I calculate the CustomerTotalRevenue?

  • Cartergan
    Cartergan Contributor

    That is the number you just calculated on the dataset with the ETL process. 

  • so my calculation, Total Revenue is calculiating the total revenue for each customer, but how do I total all the total revnue amounts up after that?

  • Cartergan
    Cartergan Contributor

    If you want total revenue (not per customer) you need a new column that takes a sum of all of the revenues and sums them together for one value for the entire column. You can use this against the individual revenues. I feel I am starting to repeat myself now so there is not much more help I can offer. Best of luck. 

  • yeah, that is what I'm trying to do is get a sum of that column of customer revenues so that I can get my percentage of revenue for each customer

     

    TotalRevenue/Sum of All Total Revenue's

     

    thanks

  • Cartergan
    Cartergan Contributor

    I just came across a way that should be able to solve your problem. 

     

    Instead of creating the dataflow with the ETL feature, use the SQL feature. 

     

    Once here, you will choose the same dataset as the input dataset. However, for one of the transforms you will sum the profit column. I attached an image to show what this might look like. From here, you should have a column with the same total revenue number for all companies which you can then use to figure specific %. 

     

    Hopefully that helps! 

  • how do you write the Output_dataset?

     

    thanks