Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Customers, Partners & Luminaries only: You're invited to a Data Analytics Roadmap session. Read More
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
MVP
MVP

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) 

 

 

Highlighted
Contributor
Contributor

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?

 

MVP
MVP

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

 

 

Highlighted
Contributor
Contributor

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

It is quite urgent also!!

Highlighted
MVP
MVP

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...

Highlighted
Contributor
Contributor

 
Highlighted
MVP
MVP

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?