Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
venkatbza
Creator
Creator

Total function in script

Hello friends,

 

How to convert front end chart expression in back end script for below mentioned expression.

=Sales/Sum(TOTAL{1} Sales)

I have a material and sales fields now i have to create a field called  'percentage of total sales '. In the front end chat above expression is working fine, but i want this expression move to back end script. 

  OUTPUT column
MaterialSalessales/sum(sales)
11010/129 =0.77519
213 
320 
45 
515 
666 
Total129 

 

Thanks,

Venkat

Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

Try this

Table:
LOAD * INLINE [
    Material, Sales
    1, 10
    2, 13
    3, 20
    4, 5
    5, 15
    6, 66
];

Left Join (Table)
LOAD Sum(Sales) as TotalSales
Resident Table;

FinalTable:
LOAD *,
	 Sales/TotalSales as [percentage of total sales]
Resident Table;

DROP Table Table;

View solution in original post

2 Replies
sunny_talwar

Try this

Table:
LOAD * INLINE [
    Material, Sales
    1, 10
    2, 13
    3, 20
    4, 5
    5, 15
    6, 66
];

Left Join (Table)
LOAD Sum(Sales) as TotalSales
Resident Table;

FinalTable:
LOAD *,
	 Sales/TotalSales as [percentage of total sales]
Resident Table;

DROP Table Table;
venkatbza
Creator
Creator
Author

Excellent, it works fine