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

Divide the specific rows to generate market share

Hello All,

One more question, I would like to divide the specific rows of one coloumn to calculate market share. I have tried many ways, but didnt get it.  Kindly share the possible solution.

Regards,

Vamsi

Labels (3)
7 Replies
petter
Partner - Champion III
Partner - Champion III

Looking at your table I can't really figure out how the total can be 230 for Area 100 - shouldn't it be 380?

 

Anyway the way to calculate totals at a certain level is like this:

 

Sum(Sales) / Sum(TOTAL Sales)  


or a sub-total:

Sum(Sales) / Sum(TOTAL <Area> Sales) 

 

 

Vamsi_T
Contributor
Contributor
Author

Thank You for the reply. It's not total of all the below rows(sum, A1, B1, C1), I just mentioned field name as "Total". 

I would like to divide the rows with specific field value "Total".

With your solution, I got an error of " Error in expression: ')' expected".  How can I fix the error?

 

petter
Partner - Champion III
Partner - Champion III

Actually I was presuming that you would calculate things in a chart or a table in the UI not in the load script.

 

Usually - best practice is to do aggregations in the charts/tables in the UI which gives you a lot more flexibility and then the expression would be:

 

Sum( Fieldname ) / Sum(TOTAL <Area> Fieldname )      // Fieldname should be replaced by the appropriate field

 

 

Vamsi_T
Contributor
Contributor
Author

I need it to add into the table with load script. Can you help me to solve this issue?

It is quite urgent also!!

petter
Partner - Champion III
Partner - Champion III

You'll have to provide me with some part of the load script so I can see the field names and table names that are relevant and give you guidance on how to approach it...

Vamsi_T
Contributor
Contributor
Author

 
petter
Partner - Champion III
Partner - Champion III

Why do you have the WHERE clause in the last LOAD statement? 

 

     Where Group <= 2

 

As far as I can see it will be a rather strange total... is this a well thought through script and actually working at least partly?